Search in sources :

Example 6 with ListenerRequestHandler

use of org.apache.wicket.core.request.handler.ListenerRequestHandler 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());
}
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) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 7 with ListenerRequestHandler

use of org.apache.wicket.core.request.handler.ListenerRequestHandler in project wicket by apache.

the class PackageMapperTest method decode5.

/**
 */
@Test
public void decode5() {
    Url url = Url.parse(MOUNT_PATH + '/' + PAGE_CLASS_NAME + "?15--foo-bar");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));
    assertThat(handler, instanceOf(ListenerRequestHandler.class));
    ListenerRequestHandler h = (ListenerRequestHandler) handler;
    IRequestablePage page = h.getPage();
    checkPage(page, 15);
    assertEquals("foo:bar", h.getComponent().getPageRelativePath());
    assertNull(h.getBehaviorIndex());
}
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 8 with ListenerRequestHandler

use of org.apache.wicket.core.request.handler.ListenerRequestHandler in project wicket by apache.

the class PackageMapperTest method decode7.

/**
 */
@Test
public void decode7() {
    Url url = Url.parse(MOUNT_PATH + '/' + PAGE_CLASS_NAME + "?15-.4-foo-bar");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));
    assertThat(handler, instanceOf(ListenerRequestHandler.class));
    ListenerRequestHandler h = (ListenerRequestHandler) handler;
    IRequestablePage page = h.getPage();
    checkPage(page, 15);
    assertEquals("foo:bar", h.getComponent().getPageRelativePath());
    assertEquals((Object) 4, h.getBehaviorIndex());
}
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 9 with ListenerRequestHandler

use of org.apache.wicket.core.request.handler.ListenerRequestHandler 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());
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) ListenerRequestHandler(org.apache.wicket.core.request.handler.ListenerRequestHandler) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 10 with ListenerRequestHandler

use of org.apache.wicket.core.request.handler.ListenerRequestHandler 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());
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) ListenerRequestHandler(org.apache.wicket.core.request.handler.ListenerRequestHandler) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Aggregations

ListenerRequestHandler (org.apache.wicket.core.request.handler.ListenerRequestHandler)30 IRequestHandler (org.apache.wicket.request.IRequestHandler)25 Url (org.apache.wicket.request.Url)25 BookmarkableListenerRequestHandler (org.apache.wicket.core.request.handler.BookmarkableListenerRequestHandler)22 Test (org.junit.Test)21 IRequestablePage (org.apache.wicket.request.component.IRequestablePage)16 PageAndComponentProvider (org.apache.wicket.core.request.handler.PageAndComponentProvider)12 PageComponentInfo (org.apache.wicket.request.mapper.info.PageComponentInfo)5 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)5 MockPage (org.apache.wicket.MockPage)4 IRequestableComponent (org.apache.wicket.request.component.IRequestableComponent)4 ComponentInfo (org.apache.wicket.request.mapper.info.ComponentInfo)4 PageInfo (org.apache.wicket.request.mapper.info.PageInfo)3 RenderPageRequestHandler (org.apache.wicket.core.request.handler.RenderPageRequestHandler)2 Page (org.apache.wicket.Page)1 IPageAndComponentProvider (org.apache.wicket.core.request.handler.IPageAndComponentProvider)1 PageProvider (org.apache.wicket.core.request.handler.PageProvider)1 RequestSettingRequestHandler (org.apache.wicket.core.request.handler.RequestSettingRequestHandler)1 WebPage (org.apache.wicket.markup.html.WebPage)1 Request (org.apache.wicket.request.Request)1