Search in sources :

Example 11 with BookmarkableListenerRequestHandler

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

the class PackageMapperTest method encode6.

/**
 */
@Test
public void encode6() {
    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);
    // shouldn't make any difference for BookmarkableListenerRequestHandler,
    // as this explicitly says the url must be bookmarkable
    page.setCreatedBookmarkable(false);
    IRequestableComponent c = page.get("foo:bar");
    PageAndComponentProvider provider = new PageAndComponentProvider(page, c);
    IRequestHandler handler = new BookmarkableListenerRequestHandler(provider);
    Url url = encoder.mapHandler(handler);
    assertEquals(MOUNT_PATH + '/' + PAGE_CLASS_NAME + "/i1/i2?15-0.-foo-bar&a=b&b=c", url.toString());
}
Also used : IRequestableComponent(org.apache.wicket.request.component.IRequestableComponent) IRequestHandler(org.apache.wicket.request.IRequestHandler) BookmarkableListenerRequestHandler(org.apache.wicket.core.request.handler.BookmarkableListenerRequestHandler) PageAndComponentProvider(org.apache.wicket.core.request.handler.PageAndComponentProvider) MockPage(org.apache.wicket.MockPage) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 12 with BookmarkableListenerRequestHandler

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

the class PackageMapperTest method encode7.

/**
 */
@Test
public void encode7() {
    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);
    // shouldn't make any difference for BookmarkableListenerRequestHandler,
    // as this explicitly says the url must be bookmarkable
    page.setCreatedBookmarkable(false);
    IRequestableComponent c = page.get("foo:bar");
    PageAndComponentProvider provider = new PageAndComponentProvider(page, c);
    IRequestHandler handler = new BookmarkableListenerRequestHandler(provider, 4);
    Url url = encoder.mapHandler(handler);
    assertEquals(MOUNT_PATH + '/' + PAGE_CLASS_NAME + "/i1/i2?15-0.4-foo-bar&a=b&b=c", url.toString());
}
Also used : IRequestableComponent(org.apache.wicket.request.component.IRequestableComponent) IRequestHandler(org.apache.wicket.request.IRequestHandler) BookmarkableListenerRequestHandler(org.apache.wicket.core.request.handler.BookmarkableListenerRequestHandler) PageAndComponentProvider(org.apache.wicket.core.request.handler.PageAndComponentProvider) MockPage(org.apache.wicket.MockPage) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 13 with BookmarkableListenerRequestHandler

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

the class Component method createRequestHandler.

/**
 * Create a suitable request handler depending whether the page is stateless or bookmarkable.
 */
private IRequestHandler createRequestHandler(PageParameters parameters, Integer id) {
    Page page = getPage();
    PageAndComponentProvider provider = new PageAndComponentProvider(page, this, parameters);
    if (page.isPageStateless() || (page.isBookmarkable() && page.wasCreatedBookmarkable())) {
        return new BookmarkableListenerRequestHandler(provider, id);
    } else {
        return new ListenerRequestHandler(provider, id);
    }
}
Also used : BookmarkableListenerRequestHandler(org.apache.wicket.core.request.handler.BookmarkableListenerRequestHandler) PageAndComponentProvider(org.apache.wicket.core.request.handler.PageAndComponentProvider) IRequestablePage(org.apache.wicket.request.component.IRequestablePage) ListenerRequestHandler(org.apache.wicket.core.request.handler.ListenerRequestHandler) BookmarkableListenerRequestHandler(org.apache.wicket.core.request.handler.BookmarkableListenerRequestHandler)

Aggregations

BookmarkableListenerRequestHandler (org.apache.wicket.core.request.handler.BookmarkableListenerRequestHandler)13 PageAndComponentProvider (org.apache.wicket.core.request.handler.PageAndComponentProvider)12 IRequestHandler (org.apache.wicket.request.IRequestHandler)11 Url (org.apache.wicket.request.Url)11 Test (org.junit.Test)10 MockPage (org.apache.wicket.MockPage)8 IRequestableComponent (org.apache.wicket.request.component.IRequestableComponent)8 ListenerRequestHandler (org.apache.wicket.core.request.handler.ListenerRequestHandler)4 IRequestablePage (org.apache.wicket.request.component.IRequestablePage)2 Page (org.apache.wicket.Page)1 BookmarkablePageRequestHandler (org.apache.wicket.core.request.handler.BookmarkablePageRequestHandler)1 RenderPageRequestHandler (org.apache.wicket.core.request.handler.RenderPageRequestHandler)1 WebPage (org.apache.wicket.markup.html.WebPage)1 IRequestHandlerDelegate (org.apache.wicket.request.IRequestHandlerDelegate)1 ComponentInfo (org.apache.wicket.request.mapper.info.ComponentInfo)1 PageComponentInfo (org.apache.wicket.request.mapper.info.PageComponentInfo)1 PageInfo (org.apache.wicket.request.mapper.info.PageInfo)1 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)1