Package org.apache.wicket.request

Examples of org.apache.wicket.request.Url

The Url class takes care of encoding and decoding of the segments and parameters. @author Matej Knopp @author Igor Vaynberg

  }

  @Test
  public void renderFullUrlAsRelativeToBaseUrlWithoutComposedContextPath()
  {
    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);
View Full Code Here


  }

  @Test
  public void renderFullUrlAsRelativeToBaseUrlWithoutFilterPath()
  {
    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);
View Full Code Here

  }

  @Test
  public void renderFullUrlAsRelativeToBaseUrlWithoutComposedFilterPath()
  {
    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);
View Full Code Here

  @Test
  public void renderFullUrlAsRelativeToBaseUrlWithFirstSegmentsEqualToTheContextPath()
  {
    // base url without context path and filter path
    // 'contextPath' here is a normal segment with the same value
    Url baseUrl = Url.parse("contextPath/a/b/c/d");

    // 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);
View Full Code Here

  @Test
  public void renderFullUrlAsRelativeToBaseUrlWithFirstSegmentsEqualToTheContextAndFilterPaths()
  {
    // base url without context path and filter path
    // 'filterPath' here is a normal segment with the same value
    Url baseUrl = Url.parse("filterPath/a/b/c/d");

    // here 'contextPath' is the actual context path and should be ignored
    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);
View Full Code Here

  @Test
  public void renderFullUrlAsRelativeToBaseUrlWithFirstSegmentsEqualToTheFilterPath()
  {
    // base url without context path and filter path
    // 'filterPath' here is a normal segment with the same value
    Url baseUrl = Url.parse("filterPath/a/b/c/d");

    // 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);
View Full Code Here

   * https://issues.apache.org/jira/browse/WICKET-5123
   */
  @Test
  public void renderHomeUrl()
  {
    Url baseUrl = Url.parse("login");

    MockWebRequest request = new MockWebRequest(baseUrl);
    UrlRenderer renderer = new UrlRenderer(request);

    Url homeUrl = Url.parse("");
    String encodedRelativeUrl = renderer.renderUrl(homeUrl);

    assertEquals(".", encodedRelativeUrl);
  }
View Full Code Here

   * https://issues.apache.org/jira/browse/WICKET-5065
   */
  @Test
  public void renderAbsoluteWithoutHost()
  {
    Url baseUrl = Url.parse("a/b");

    MockWebRequest request = new MockWebRequest(baseUrl);
    UrlRenderer renderer = new UrlRenderer(request);

    Url absoluteUrl = Url.parse("/c/d");
    String encodedRelativeUrl = renderer.renderUrl(absoluteUrl);

    assertEquals("/c/d", encodedRelativeUrl);
  }
View Full Code Here

   * https://issues.apache.org/jira/browse/WICKET-5065
   */
  @Test
  public void renderAbsoluteWithoutScheme()
  {
    Url baseUrl = Url.parse("a/b");

    MockWebRequest request = new MockWebRequest(baseUrl);
    UrlRenderer renderer = new UrlRenderer(request);

    Url absoluteUrl = Url.parse("//host/c/d");
    String encodedRelativeUrl = renderer.renderUrl(absoluteUrl);

    assertEquals("//host/c/d", encodedRelativeUrl);
  }
View Full Code Here

   * https://issues.apache.org/jira/browse/WICKET-5065
   */
  @Test
  public void renderAbsoluteWithoutSchemeWithPort()
  {
    Url baseUrl = Url.parse("a/b");

    MockWebRequest request = new MockWebRequest(baseUrl);
    UrlRenderer renderer = new UrlRenderer(request);

    Url absoluteUrl = Url.parse("//host:1234/c/d");
    String encodedRelativeUrl = renderer.renderUrl(absoluteUrl);

    assertEquals("//host:1234/c/d", encodedRelativeUrl);
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.request.Url

Copyright © 2018 www.massapicom. 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.