use of org.apache.wicket.request.IRequestHandler in project wicket by apache.
the class MountedMapperTest method placeholderEncode2.
/**
*/
@Test
public void placeholderEncode2() {
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);
parameters.set("param1", "p1", INamedParameters.Type.PATH);
parameters.set("param2", "p2", INamedParameters.Type.PATH);
PageProvider provider = new PageProvider(MockPage.class, parameters);
provider.setPageSource(context);
IRequestHandler handler = new BookmarkablePageRequestHandler(provider);
Url url = placeholderEncoder.mapHandler(handler);
assertEquals("some/p1/path/p2/i1/i2?a=b&b=c", url.toString());
}
use of org.apache.wicket.request.IRequestHandler in project wicket by apache.
the class MountedMapperTest method encode3.
/**
*/
@Test
public void encode3() {
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("some/mount/path/i1/i2?a=b&b=c", url.toString());
}
use of org.apache.wicket.request.IRequestHandler in project wicket by apache.
the class MountedMapperTest method decode12.
/**
*/
@Test
public void decode12() {
Url url = Url.parse("some/mount/path/i1/i2?-1.-foo-bar&a=b&b=c");
IRequestHandler handler = encoder.mapRequest(getRequest(url));
assertThat(handler, instanceOf(ListenerRequestHandler.class));
ListenerRequestHandler h = (ListenerRequestHandler) handler;
IRequestablePage page = h.getPage();
checkPage(page, 1);
assertEquals("foo:bar", h.getComponent().getPageRelativePath());
assertNull(h.getBehaviorIndex());
PageParameters p = page.getPageParameters();
assertEquals(2, p.getIndexedCount());
assertEquals(2, p.getNamedKeys().size());
}
use of org.apache.wicket.request.IRequestHandler in project wicket by apache.
the class MountedMapperTest 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("some/mount/path/i1/i2?15&a=b&b=c", url.toString());
}
use of org.apache.wicket.request.IRequestHandler in project wicket by apache.
the class MountedMapperTest method optionPlaceholderDecode1.
/**
*/
@Test
public void optionPlaceholderDecode1() {
Url url = Url.parse("some/p1/path/p2/p3");
IRequestHandler handler = optionPlaceholderEncoder.mapRequest(getRequest(url));
assertThat(handler, instanceOf(RenderPageRequestHandler.class));
IRequestablePage page = ((RenderPageRequestHandler) handler).getPage();
assertEquals(0, page.getPageParameters().getIndexedCount());
assertEquals(3, page.getPageParameters().getNamedKeys().size());
assertEquals("p1", page.getPageParameters().get("param1").toString());
assertEquals("p2", page.getPageParameters().get("param2").toString());
assertEquals("p3", page.getPageParameters().get("param3").toString());
}
Aggregations