Search in sources :

Example 71 with IRequestHandler

use of org.apache.wicket.request.IRequestHandler in project wicket by apache.

the class PackageMapperTest method decode11.

/**
 * https://issues.apache.org/jira/browse/WICKET-5996
 */
@Test
public void decode11() {
    Url url = Url.parse(MOUNT_PATH);
    IRequestHandler handler = encoder.mapRequest(getRequest(url));
    assertThat(handler, is(nullValue()));
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 72 with IRequestHandler

use of org.apache.wicket.request.IRequestHandler in project wicket by apache.

the class PackageMapperTest method encodeAlias.

/**
 * https://issues.apache.org/jira/browse/WICKET-3941
 */
@Test
public void encodeAlias() {
    MockPage page = new MockPage(15);
    page.setBookmarkable(true);
    page.setCreatedBookmarkable(true);
    page.setPageStateless(true);
    IPageProvider provider = new PageProvider(page);
    IRequestHandler handler = new RenderPageRequestHandler(provider);
    Url url = aliasEncoder.mapHandler(handler);
    assertEquals(MOUNT_PATH + '/' + ALIAS, url.toString());
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) RenderPageRequestHandler(org.apache.wicket.core.request.handler.RenderPageRequestHandler) PageProvider(org.apache.wicket.core.request.handler.PageProvider) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) MockPage(org.apache.wicket.MockPage) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 73 with IRequestHandler

use of org.apache.wicket.request.IRequestHandler 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 74 with IRequestHandler

use of org.apache.wicket.request.IRequestHandler 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 75 with IRequestHandler

use of org.apache.wicket.request.IRequestHandler in project wicket by apache.

the class PackageMapperTest method encode8.

/**
 */
@Test
public void encode8() {
    MockPage page = new MockPage(15);
    page.setBookmarkable(true);
    page.setCreatedBookmarkable(true);
    page.setPageStateless(true);
    IPageProvider provider = new PageProvider(page);
    IRequestHandler handler = new RenderPageRequestHandler(provider);
    Url url = encoder.mapHandler(handler);
    assertEquals(MOUNT_PATH + '/' + PAGE_CLASS_NAME, url.toString());
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) RenderPageRequestHandler(org.apache.wicket.core.request.handler.RenderPageRequestHandler) PageProvider(org.apache.wicket.core.request.handler.PageProvider) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) IPageProvider(org.apache.wicket.core.request.handler.IPageProvider) MockPage(org.apache.wicket.MockPage) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Aggregations

IRequestHandler (org.apache.wicket.request.IRequestHandler)188 Test (org.junit.Test)159 Url (org.apache.wicket.request.Url)138 RenderPageRequestHandler (org.apache.wicket.core.request.handler.RenderPageRequestHandler)65 IRequestablePage (org.apache.wicket.request.component.IRequestablePage)47 PageProvider (org.apache.wicket.core.request.handler.PageProvider)45 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)36 IPageProvider (org.apache.wicket.core.request.handler.IPageProvider)32 BookmarkableListenerRequestHandler (org.apache.wicket.core.request.handler.BookmarkableListenerRequestHandler)28 ListenerRequestHandler (org.apache.wicket.core.request.handler.ListenerRequestHandler)25 Request (org.apache.wicket.request.Request)25 MockPage (org.apache.wicket.MockPage)23 ResourceReferenceRequestHandler (org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler)20 PageAndComponentProvider (org.apache.wicket.core.request.handler.PageAndComponentProvider)17 ResourceUrl (org.apache.wicket.request.resource.caching.ResourceUrl)17 BookmarkablePageRequestHandler (org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler)16 IPageRequestHandler (org.apache.wicket.core.request.handler.IPageRequestHandler)11 IRequestableComponent (org.apache.wicket.request.component.IRequestableComponent)10 RequestCycle (org.apache.wicket.request.cycle.RequestCycle)8 Page (org.apache.wicket.Page)6