Search in sources :

Example 51 with IRequestablePage

use of org.apache.wicket.request.component.IRequestablePage in project wicket by apache.

the class MountedMapperTest method decode1.

/**
 */
@Test
public void decode1() {
    Url url = Url.parse("some/mount/path");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));
    assertThat(handler, instanceOf(RenderPageRequestHandler.class));
    IRequestablePage page = ((RenderPageRequestHandler) handler).getPage();
    assertEquals(0, page.getPageParameters().getIndexedCount());
    assertTrue(page.getPageParameters().getNamedKeys().isEmpty());
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) RenderPageRequestHandler(org.apache.wicket.core.request.handler.RenderPageRequestHandler) IRequestablePage(org.apache.wicket.request.component.IRequestablePage) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 52 with IRequestablePage

use of org.apache.wicket.request.component.IRequestablePage in project wicket by apache.

the class MountedMapperTest method placeholderDecode1.

/**
 */
@Test
public void placeholderDecode1() {
    Url url = Url.parse("some/p1/path/p2");
    IRequestHandler handler = placeholderEncoder.mapRequest(getRequest(url));
    assertThat(handler, instanceOf(RenderPageRequestHandler.class));
    IRequestablePage page = ((RenderPageRequestHandler) handler).getPage();
    assertEquals(0, page.getPageParameters().getIndexedCount());
    assertTrue(page.getPageParameters().getNamedKeys().size() == 2);
    assertEquals("p1", page.getPageParameters().get("param1").toString());
    assertEquals("p2", page.getPageParameters().get("param2").toString());
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) RenderPageRequestHandler(org.apache.wicket.core.request.handler.RenderPageRequestHandler) IRequestablePage(org.apache.wicket.request.component.IRequestablePage) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 53 with IRequestablePage

use of org.apache.wicket.request.component.IRequestablePage in project wicket by apache.

the class PackageMapperTest method decodeNamedParameters.

/**
 */
@Test
public void decodeNamedParameters() {
    Url url = Url.parse(MOUNT_PATH + "/fooValue/barValue/" + PAGE_CLASS_NAME + "/i1/i2?a=b&b=c");
    IRequestHandler handler = namedParametersEncoder.mapRequest(getRequest(url));
    assertTrue(handler instanceof RenderPageRequestHandler);
    RenderPageRequestHandler h = (RenderPageRequestHandler) handler;
    IRequestablePage page = h.getPage();
    checkPage(page, 1);
    PageParameters p = h.getPageParameters();
    assertEquals(2, p.getIndexedCount());
    assertEquals(4, p.getNamedKeys().size());
    assertEquals("fooValue", p.get("foo").toString());
    assertEquals("barValue", p.get("bar").toString());
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) RenderPageRequestHandler(org.apache.wicket.core.request.handler.RenderPageRequestHandler) IRequestablePage(org.apache.wicket.request.component.IRequestablePage) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 54 with IRequestablePage

use of org.apache.wicket.request.component.IRequestablePage in project wicket by apache.

the class PackageMapperTest method decode8.

/**
 */
@Test
public void decode8() {
    Url url = Url.parse(MOUNT_PATH + '/' + PAGE_CLASS_NAME + "/i1/i2?15-5.-foo-bar&a=b&b=c");
    context.setNextPageRenderCount(5);
    IRequestHandler handler = encoder.mapRequest(getRequest(url));
    assertThat(handler, instanceOf(ListenerRequestHandler.class));
    ListenerRequestHandler h = (ListenerRequestHandler) handler;
    IRequestablePage page = h.getPage();
    assertEquals(page.getRenderCount(), 5);
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) IRequestablePage(org.apache.wicket.request.component.IRequestablePage) ListenerRequestHandler(org.apache.wicket.core.request.handler.ListenerRequestHandler) BookmarkableListenerRequestHandler(org.apache.wicket.core.request.handler.BookmarkableListenerRequestHandler) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 55 with IRequestablePage

use of org.apache.wicket.request.component.IRequestablePage in project wicket by apache.

the class PackageMapperTest method decode2.

/**
 */
@Test
public void decode2() {
    Url url = Url.parse(MOUNT_PATH + '/' + PAGE_CLASS_NAME + "/indexed1?a=b&b=c");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));
    assertThat(handler, instanceOf(RenderPageRequestHandler.class));
    IRequestablePage page = ((RenderPageRequestHandler) handler).getPage();
    assertEquals(PAGE_CLASS_NAME, page.getClass().getSimpleName());
    PageParameters p = page.getPageParameters();
    assertEquals(1, p.getIndexedCount());
    assertEquals("indexed1", p.get(0).toString());
    assertEquals(2, p.getNamedKeys().size());
    assertEquals("b", p.get("a").toString());
    assertEquals("c", p.get("b").toString());
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) RenderPageRequestHandler(org.apache.wicket.core.request.handler.RenderPageRequestHandler) IRequestablePage(org.apache.wicket.request.component.IRequestablePage) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Aggregations

IRequestablePage (org.apache.wicket.request.component.IRequestablePage)59 Url (org.apache.wicket.request.Url)50 IRequestHandler (org.apache.wicket.request.IRequestHandler)47 Test (org.junit.Test)46 RenderPageRequestHandler (org.apache.wicket.core.request.handler.RenderPageRequestHandler)31 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)18 ListenerRequestHandler (org.apache.wicket.core.request.handler.ListenerRequestHandler)15 BookmarkableListenerRequestHandler (org.apache.wicket.core.request.handler.BookmarkableListenerRequestHandler)14 IPageRequestHandler (org.apache.wicket.core.request.handler.IPageRequestHandler)6 Request (org.apache.wicket.request.Request)6 PageComponentInfo (org.apache.wicket.request.mapper.info.PageComponentInfo)5 PageProvider (org.apache.wicket.core.request.handler.PageProvider)4 PageInfo (org.apache.wicket.request.mapper.info.PageInfo)4 IPageProvider (org.apache.wicket.core.request.handler.IPageProvider)3 ComponentInfo (org.apache.wicket.request.mapper.info.ComponentInfo)3 Page (org.apache.wicket.Page)2 AccessControlException (java.security.AccessControlException)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 ForbiddenException (javax.ws.rs.ForbiddenException)1 Login (org.apache.syncope.client.console.pages.Login)1