use of org.apache.wicket.request.UrlRenderer 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.request.UrlRenderer in project wicket by apache.
the class WebPageRendererTest method before.
/**
* Common setup
*/
@Before
public void before() {
provider = mock(IPageProvider.class);
page = mock(IRequestablePage.class);
when(provider.getPageInstance()).thenReturn(page);
handler = new RenderPageRequestHandler(provider);
requestCycle = mock(RequestCycle.class);
urlRenderer = mock(UrlRenderer.class);
when(requestCycle.getUrlRenderer()).thenReturn(urlRenderer);
request = mock(WebRequest.class);
when(requestCycle.getRequest()).thenReturn(request);
response = mock(WebResponse.class);
when(requestCycle.getResponse()).thenReturn(response);
}
use of org.apache.wicket.request.UrlRenderer 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);
}
use of org.apache.wicket.request.UrlRenderer in project wicket by apache.
the class UrlRendererTest method test3.
/**
*/
@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")));
}
use of org.apache.wicket.request.UrlRenderer in project wicket by apache.
the class UrlRendererTest method removeCommonPrefixesWicket5073.
/**
* https://issues.apache.org/jira/browse/WICKET-5073
*/
@Test
public void removeCommonPrefixesWicket5073() {
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);
}
Aggregations