use of org.apache.wicket.request.IRequestHandler in project wicket by apache.
the class PackageMapperTest method encode2.
/**
*/
@Test
public void encode2() {
PageParameters parameters = new PageParameters();
parameters.set(0, "i1");
parameters.set(1, "i2");
parameters.set("a", "b", INamedParameters.Type.QUERY_STRING);
parameters.set("b", "c", INamedParameters.Type.QUERY_STRING);
PageProvider provider = new PageProvider(MockPage.class, parameters);
provider.setPageSource(context);
IRequestHandler handler = new BookmarkablePageRequestHandler(provider);
Url url = encoder.mapHandler(handler);
assertEquals(MOUNT_PATH + '/' + PAGE_CLASS_NAME + "/i1/i2?a=b&b=c", url.toString());
}
use of org.apache.wicket.request.IRequestHandler in project wicket by apache.
the class PackageMapperTest method decodeAlias.
/**
* https://issues.apache.org/jira/browse/WICKET-3941
*/
@Test
public void decodeAlias() {
Url url = Url.parse(MOUNT_PATH + '/' + ALIAS + "?15");
IRequestHandler handler = aliasEncoder.mapRequest(getRequest(url));
assertThat(handler, instanceOf(RenderPageRequestHandler.class));
IRequestablePage page = ((RenderPageRequestHandler) handler).getPage();
checkPage(page, 15);
assertEquals(PAGE_CLASS_NAME, page.getClass().getSimpleName());
}
use of org.apache.wicket.request.IRequestHandler in project wicket by apache.
the class PackageMapperTest method encode4.
/**
*/
@Test
public void encode4() {
MockPage page = new MockPage(15);
page.getPageParameters().set(0, "i1");
page.getPageParameters().set(1, "i2");
page.getPageParameters().set("a", "b", INamedParameters.Type.QUERY_STRING);
page.getPageParameters().set("b", "c", INamedParameters.Type.QUERY_STRING);
page.setCreatedBookmarkable(true);
IPageProvider provider = new PageProvider(page);
IRequestHandler handler = new RenderPageRequestHandler(provider);
Url url = encoder.mapHandler(handler);
assertEquals(MOUNT_PATH + '/' + PAGE_CLASS_NAME + "/i1/i2?15&a=b&b=c", url.toString());
}
use of org.apache.wicket.request.IRequestHandler in project wicket by apache.
the class PageInstanceMapperTest method decode3.
/**
*/
@Test
public void decode3() {
Url url = Url.parse("wicket/page?4--a-b-c");
IRequestHandler handler = encoder.mapRequest(getRequest(url));
assertThat(handler, instanceOf(ListenerRequestHandler.class));
ListenerRequestHandler h = (ListenerRequestHandler) handler;
checkPage(h.getPage(), 4);
assertEquals(h.getComponent().getPageRelativePath(), "a:b:c");
assertNull(h.getBehaviorIndex());
}
use of org.apache.wicket.request.IRequestHandler in project wicket by apache.
the class PageInstanceMapperTest method decode7.
/**
*/
@Test
public void decode7() {
Url url = Url.parse("wicket/page?4-6.5-a-b-c");
context.setNextPageRenderCount(6);
IRequestHandler handler = encoder.mapRequest(getRequest(url));
assertThat(handler, instanceOf(ListenerRequestHandler.class));
ListenerRequestHandler h = (ListenerRequestHandler) handler;
assertEquals(6, h.getPage().getRenderCount());
}
Aggregations