use of org.apache.wicket.mock.MockWebRequest in project wicket by apache.
the class UrlRendererTest method test16.
/**
* prevent another double slash when common prefix is present
*/
@Test
public void test16() {
UrlRenderer r1 = new UrlRenderer(new MockWebRequest(Url.parse("private/AdminPage")).setContextPath("context"));
assertEquals("../signIn;jsessionid=16k3wqa9c4sgq1cnp7fisa20u", r1.renderRelativeUrl(Url.parse("/context/signIn;jsessionid=16k3wqa9c4sgq1cnp7fisa20u")));
}
use of org.apache.wicket.mock.MockWebRequest in project wicket by apache.
the class UrlRendererTest method renderAbsoluteWithoutSchemeWithPort.
/**
* 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);
}
use of org.apache.wicket.mock.MockWebRequest in project wicket by apache.
the class UrlRendererTest method renderAbsoluteWithoutScheme.
/**
* 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);
}
use of org.apache.wicket.mock.MockWebRequest in project wicket by apache.
the class UrlRendererTest method renderUrlWithManyDotsAtTheEnd2.
/**
* https://issues.apache.org/jira/browse/WICKET-6230
*/
@Test
public void renderUrlWithManyDotsAtTheEnd2() {
UrlRenderer renderer = new UrlRenderer(new MockWebRequest(Url.parse("a/b")));
String renderedUrl = renderer.renderUrl(Url.parse("abc..."));
assertEquals("../abc...", renderedUrl);
}
use of org.apache.wicket.mock.MockWebRequest in project wicket by apache.
the class UrlRendererTest method renderFullUrlAsRelativeToBaseUrlWithoutSchemeHostnameAndPort.
@Test
public void renderFullUrlAsRelativeToBaseUrlWithoutSchemeHostnameAndPort() {
Url baseUrl = Url.parse("/contextPath/filterPath/a/b/c/d");
Url encodedFullUrl = Url.parse("http://host:8080/contextPath/filterPath/a/b;jsessionid=123456");
UrlRenderer renderer = new UrlRenderer(new MockWebRequest(baseUrl));
String encodedRelativeUrl = renderer.renderRelativeUrl(encodedFullUrl);
assertEquals("../../b;jsessionid=123456", encodedRelativeUrl);
}
Aggregations