use of org.apache.wicket.request.UrlRenderer in project wicket by apache.
the class UrlRendererTest method test15.
/**
* WICKET-4935 prevent another double slash
*/
@Test
public void test15() {
UrlRenderer r1 = new UrlRenderer(new MockWebRequest(Url.parse("private/AdminPage")));
assertEquals("../signIn;jsessionid=16k3wqa9c4sgq1cnp7fisa20u", r1.renderRelativeUrl(Url.parse("/signIn;jsessionid=16k3wqa9c4sgq1cnp7fisa20u")));
}
use of org.apache.wicket.request.UrlRenderer in project wicket by apache.
the class UrlRendererTest method renderUrlWithManyDotsAtTheEnd1.
/**
* https://issues.apache.org/jira/browse/WICKET-6230
*/
@Test
public void renderUrlWithManyDotsAtTheEnd1() {
UrlRenderer renderer = new UrlRenderer(new MockWebRequest(Url.parse("a")));
String renderedUrl = renderer.renderUrl(Url.parse("abc..."));
assertEquals("./abc...", renderedUrl);
}
use of org.apache.wicket.request.UrlRenderer in project wicket by apache.
the class UrlRendererTest method renderFullUrlAsRelativeToBaseUrlWithFirstSegmentsEqualToTheContextAndFilterPaths.
@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);
String encodedRelativeUrl = renderer.renderRelativeUrl(encodedFullUrl);
assertEquals("../../../../a/b;jsessionid=123456", encodedRelativeUrl);
}
use of org.apache.wicket.request.UrlRenderer in project wicket by apache.
the class UrlRendererTest method test5.
/**
*/
@Test
public void test5() {
UrlRenderer r1 = new UrlRenderer(new MockWebRequest(Url.parse("url")));
assertEquals("./url?1", r1.renderUrl(Url.parse("url?1")));
}
use of org.apache.wicket.request.UrlRenderer in project wicket by apache.
the class UrlRendererTest method renderFullUrlAsRelativeToBaseUrlWithoutContextAndFilterPaths.
@Test
public void renderFullUrlAsRelativeToBaseUrlWithoutContextAndFilterPaths() {
// base url without context path and filter path
Url baseUrl = Url.parse("a/b/c/d");
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("../../b;jsessionid=123456", encodedRelativeUrl);
}
Aggregations