Package org.apache.wicket.request

Examples of org.apache.wicket.request.UrlRenderer


  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


  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

  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

  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

    Url baseUrl = new Url(Arrays.asList(""), Arrays.<Url.QueryParameter> asList());

    MockWebRequest request = new MockWebRequest(baseUrl);
    request.setContextPath("/qs");
    request.setFilterPath("");
    UrlRenderer renderer = new UrlRenderer(request);
    renderer.setBaseUrl(baseUrl);

    String rendered = renderer.renderRelativeUrl(Url.parse("wicket/resource/org.apache.wicket.Application/x.css"));
    assertEquals("./wicket/resource/org.apache.wicket.Application/x.css", rendered);
  }
View Full Code Here

    Url baseUrl = new Url(Arrays.asList("", "SomePage;jsessionid=1234"), Arrays.<Url.QueryParameter>asList());

    MockWebRequest request = new MockWebRequest(baseUrl);
    request.setContextPath("/");
    request.setFilterPath("filter");
    UrlRenderer renderer = new UrlRenderer(request);
    renderer.setBaseUrl(baseUrl);

    String rendered = renderer.renderRelativeUrl(Url.parse("/filter;jsessionid=1234"));
    assertEquals("../", rendered);
  }
View Full Code Here

   *
   */
  @Test
  public void test1()
  {
    UrlRenderer r1 = new UrlRenderer(new MockWebRequest(Url.parse("foo/bar/baz?a=b")));
    assertEquals("./xyz?x=y", r1.renderUrl(Url.parse("foo/bar/xyz?x=y")));
    assertEquals("./baz/xyz?x=y", r1.renderUrl(Url.parse("foo/bar/baz/xyz?x=y")));
    assertEquals("../aaa/xyz?x=y", r1.renderUrl(Url.parse("foo/aaa/xyz?x=y")));
    assertEquals("../../bbb/aaa/xyz?x=y", r1.renderUrl(Url.parse("bbb/aaa/xyz?x=y")));
  }
View Full Code Here

   *
   */
  @Test
  public void test2()
  {
    UrlRenderer r1 = new UrlRenderer(new MockWebRequest(Url.parse("foo/bar/baz?a=b")));
    assertEquals("../../foo?x=y", r1.renderUrl(Url.parse("foo?x=y")));
    assertEquals("../../aaa?x=y", r1.renderUrl(Url.parse("aaa?x=y")));
  }
View Full Code Here

   *
   */
  @Test
  public void test3()
  {
    UrlRenderer r1 = new UrlRenderer(new MockWebRequest(Url.parse("?a=b")));
    assertEquals("./a/b/c?x=y", r1.renderUrl(Url.parse("a/b/c?x=y")));
  }
View Full Code Here

   *
   */
  @Test
  public void test5()
  {
    UrlRenderer r1 = new UrlRenderer(new MockWebRequest(Url.parse("url")));
    assertEquals("./url?1", r1.renderUrl(Url.parse("url?1")));
  }
View Full Code Here

TOP

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

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.