Examples of UrlRenderer


Examples of org.apache.wicket.request.UrlRenderer

    Url encodedFullUrl = Url.parse("http://host:8080/context/path/filter/path/a/b;jsessionid=123456");

    MockWebRequest request = new MockWebRequest(baseUrl);
    request.setContextPath("context/path");
    request.setFilterPath("filter/path");
    UrlRenderer renderer = new UrlRenderer(request);
    String encodedRelativeUrl = renderer.renderRelativeUrl(encodedFullUrl);

    assertEquals("../../b;jsessionid=123456", encodedRelativeUrl);
  }
View Full Code Here

Examples of org.apache.wicket.request.UrlRenderer

    Url baseUrl = Url.parse("a/b/c/d"); // base url without context path and filter path
    Url encodedFullUrl = Url.parse("http://host:8080/filterPath/a/b;jsessionid=123456");

    MockWebRequest request = new MockWebRequest(baseUrl);
    request.setFilterPath("filterPath");
    UrlRenderer renderer = new UrlRenderer(request);
    String encodedRelativeUrl = renderer.renderRelativeUrl(encodedFullUrl);

    assertEquals("../../b;jsessionid=123456", encodedRelativeUrl);
  }
View Full Code Here

Examples of org.apache.wicket.request.UrlRenderer

    Url baseUrl = Url.parse("a/b/c/d"); // base url without context path and filter path
    Url encodedFullUrl = Url.parse("http://host:8080/filter/path/a/b;jsessionid=123456");

    MockWebRequest request = new MockWebRequest(baseUrl);
    request.setFilterPath("filter/path");
    UrlRenderer renderer = new UrlRenderer(request);
    String encodedRelativeUrl = renderer.renderRelativeUrl(encodedFullUrl);

    assertEquals("../../b;jsessionid=123456", encodedRelativeUrl);
  }
View Full Code Here

Examples of org.apache.wicket.request.UrlRenderer

    Url baseUrl = Url.parse("a/b/c/d"); // base url without context path and filter path
    Url encodedFullUrl = Url.parse("http://host:8080/contextPath/a/b;jsessionid=123456");

    MockWebRequest request = new MockWebRequest(baseUrl);
    request.setContextPath("contextPath");
    UrlRenderer renderer = new UrlRenderer(request);
    String encodedRelativeUrl = renderer.renderRelativeUrl(encodedFullUrl);

    assertEquals("../../b;jsessionid=123456", encodedRelativeUrl);
  }
View Full Code Here

Examples of org.apache.wicket.request.UrlRenderer

    Url baseUrl = Url.parse("a/b/c/d"); // base url without context path and filter path
    Url encodedFullUrl = Url.parse("http://host:8080/context/path/a/b;jsessionid=123456");

    MockWebRequest request = new MockWebRequest(baseUrl);
    request.setContextPath("context/path");
    UrlRenderer renderer = new UrlRenderer(request);
    String encodedRelativeUrl = renderer.renderRelativeUrl(encodedFullUrl);

    assertEquals("../../b;jsessionid=123456", encodedRelativeUrl);
  }
View Full Code Here

Examples of org.apache.wicket.request.UrlRenderer

    // here 'contextPath' is the actual context path and should be ignored
    Url encodedFullUrl = Url.parse("http://host:8080/contextPath/a/b;jsessionid=123456");

    MockWebRequest request = new MockWebRequest(baseUrl);
    request.setContextPath("contextPath");
    UrlRenderer renderer = new UrlRenderer(request);
    String encodedRelativeUrl = renderer.renderRelativeUrl(encodedFullUrl);

    assertEquals("../../../../a/b;jsessionid=123456", encodedRelativeUrl);
  }
View Full Code Here

Examples of org.apache.wicket.request.UrlRenderer

    Url encodedFullUrl = Url.parse("http://host:8080/contextPath/filterPath/a/b;jsessionid=123456");

    MockWebRequest request = new MockWebRequest(baseUrl);
    request.setContextPath("contextPath");
    request.setFilterPath("filterPath");
    UrlRenderer renderer = new UrlRenderer(request);
    String encodedRelativeUrl = renderer.renderRelativeUrl(encodedFullUrl);

    assertEquals("../../../../a/b;jsessionid=123456", encodedRelativeUrl);
  }
View Full Code Here

Examples of org.apache.wicket.request.UrlRenderer

    // here 'filterPath' is the actual filter path and should be ignored
    Url encodedFullUrl = Url.parse("http://host:8080/filterPath/a/b;jsessionid=123456");

    MockWebRequest request = new MockWebRequest(baseUrl);
    request.setFilterPath("filterPath");
    UrlRenderer renderer = new UrlRenderer(request);
    String encodedRelativeUrl = renderer.renderRelativeUrl(encodedFullUrl);

    assertEquals("../../../../a/b;jsessionid=123456", encodedRelativeUrl);
  }
View Full Code Here

Examples of org.apache.wicket.request.UrlRenderer

   * @return a new url renderer
   */
  protected UrlRenderer newUrlRenderer()
  {
    // All URLs will be rendered relative to current request (can be overridden afterwards)
    return new UrlRenderer(getRequest());
  }
View Full Code Here

Examples of org.apache.wicket.request.UrlRenderer

  @Override
  public String encodeURL(CharSequence url)
  {
    Args.notNull(url, "url");

    UrlRenderer urlRenderer = getUrlRenderer();

    Url originalUrl = Url.parse(url);

    /*
      WICKET-4645 - always pass absolute url to the web container for encoding
      because when REDIRECT_TO_BUFFER is in use Wicket may render PageB when
      PageA is actually the requested one and the web container cannot resolve
      the base url properly
     */
    String fullUrl = urlRenderer.renderFullUrl(originalUrl);
    String encodedFullUrl = httpServletResponse.encodeURL(fullUrl);

    final String encodedUrl;
    if (originalUrl.isFull())
    {
      encodedUrl = encodedFullUrl;
    }
    else
    {
      if (fullUrl.equals(encodedFullUrl))
      {
        // no encoding happened so just reuse the original url
        encodedUrl = url.toString();
      }
      else
      {
        // get the relative url with the jsessionid encoded in it
        Url _encoded = Url.parse(encodedFullUrl);
        encodedUrl = urlRenderer.renderRelativeUrl(_encoded);
      }
    }
    return encodedUrl;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.