use of org.apache.wicket.core.request.handler.RenderPageRequestHandler in project wicket by apache.
the class BookmarkableMapperTest method decodePageClassWithPathParameters.
/**
* https://issues.apache.org/jira/browse/WICKET-5500
*/
@Test
public void decodePageClassWithPathParameters() {
Url url = Url.parse("wicket/bookmarkable/" + PAGE_CLASS_NAME + ";something=else");
IRequestHandler handler = encoder.mapRequest(getRequest(url));
assertTrue(handler instanceof RenderPageRequestHandler);
IRequestablePage page = ((RenderPageRequestHandler) handler).getPage();
assertEquals(PAGE_CLASS_NAME, page.getClass().getName());
assertEquals(0, page.getPageParameters().getIndexedCount());
assertTrue(page.getPageParameters().getNamedKeys().isEmpty());
}
use of org.apache.wicket.core.request.handler.RenderPageRequestHandler in project wicket by apache.
the class CryptoMapperTest method bookmarkablePageDecryptMultipleCryptoMapper.
/**
* Tests that encrypted URLs for bookmarkable pages are decrypted and passed to the wrapped mapper when there is more than
* one cryptomapper installed.
*/
@Test
public void bookmarkablePageDecryptMultipleCryptoMapper() {
Request request = getRequest(Url.parse(ENCRYPTED_BOOKMARKABLE_URL));
IRequestHandler requestHandler = new CryptoMapper(mapper, tester.getApplication()).mapRequest(request);
assertNotNull(requestHandler);
requestHandler = unwrapRequestHandlerDelegate(requestHandler);
assertThat(requestHandler, instanceOf(RenderPageRequestHandler.class));
RenderPageRequestHandler handler = (RenderPageRequestHandler) requestHandler;
assertEquals(Page2.class, handler.getPageClass());
}
use of org.apache.wicket.core.request.handler.RenderPageRequestHandler in project wicket by apache.
the class CryptoMapperTest method bookmarkablePageDecrypt.
/**
* Tests that encrypted URLs for bookmarkable pages are decrypted and passed to the wrapped mapper.
*/
@Test
public void bookmarkablePageDecrypt() {
Request request = getRequest(Url.parse(ENCRYPTED_BOOKMARKABLE_URL));
IRequestHandler requestHandler = mapper.mapRequest(request);
assertNotNull(requestHandler);
requestHandler = unwrapRequestHandlerDelegate(requestHandler);
assertThat(requestHandler, instanceOf(RenderPageRequestHandler.class));
RenderPageRequestHandler handler = (RenderPageRequestHandler) requestHandler;
assertEquals(Page2.class, handler.getPageClass());
}
use of org.apache.wicket.core.request.handler.RenderPageRequestHandler in project wicket by apache.
the class CryptoMapperTest method pageInstanceDecryptMultipleCryptoMapper.
/**
* Make sure that encrypted page instance URLs are decrypted and the correct handler resolved.
*/
@Test
public void pageInstanceDecryptMultipleCryptoMapper() {
IRequestHandler requestHandler = new CryptoMapper(mapper, tester.getApplication()).mapRequest(getRequest(Url.parse(ENCRYPTED_PAGE_INSTANCE_URL)));
assertNotNull(requestHandler);
requestHandler = unwrapRequestHandlerDelegate(requestHandler);
assertThat(requestHandler, instanceOf(RenderPageRequestHandler.class));
RenderPageRequestHandler handler = (RenderPageRequestHandler) requestHandler;
assertEquals(5, handler.getPageId().intValue());
}
use of org.apache.wicket.core.request.handler.RenderPageRequestHandler in project wicket by apache.
the class CryptoMapperTest method pageInstanceEncrypt.
/**
* Tests that URLs for page instances are encrypted (/wicket/page?5)
*/
@Test
public void pageInstanceEncrypt() {
MockPage page = new MockPage(5);
IRequestHandler requestHandler = new RenderPageRequestHandler(new PageProvider(page));
assertEquals(PLAIN_PAGE_INSTANCE_URL, mapper.getDelegateMapper().mapHandler(requestHandler).toString());
assertEquals(ENCRYPTED_PAGE_INSTANCE_URL, mapper.mapHandler(requestHandler).toString());
}
Aggregations