Search in sources :

Example 21 with IRequestablePage

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

the class PackageMapperTest method decode1.

/**
 */
@Test
public void decode1() {
    Url url = Url.parse(MOUNT_PATH + '/' + PAGE_CLASS_NAME);
    IRequestHandler handler = encoder.mapRequest(getRequest(url));
    assertThat(handler, instanceOf(RenderPageRequestHandler.class));
    IRequestablePage page = ((RenderPageRequestHandler) handler).getPage();
    assertEquals(PAGE_CLASS_NAME, page.getClass().getSimpleName());
    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 22 with IRequestablePage

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

the class PackageMapperTest method decodePageClassWithPathParameters.

/**
 * https://issues.apache.org/jira/browse/WICKET-5500
 */
@Test
public void decodePageClassWithPathParameters() {
    Url url = Url.parse(MOUNT_PATH + '/' + PAGE_CLASS_NAME + ";something=else");
    IRequestHandler handler = encoder.mapRequest(getRequest(url));
    assertTrue(handler instanceof RenderPageRequestHandler);
    IRequestablePage page = ((RenderPageRequestHandler) handler).getPage();
    assertEquals(PAGE_CLASS_NAME, page.getClass().getSimpleName());
    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 23 with IRequestablePage

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

the class PackageMapperTest method decodeAlias.

/**
 * https://issues.apache.org/jira/browse/WICKET-3941
 */
@Test
public void decodeAlias() {
    Url url = Url.parse(MOUNT_PATH + '/' + ALIAS + "?15");
    IRequestHandler handler = aliasEncoder.mapRequest(getRequest(url));
    assertThat(handler, instanceOf(RenderPageRequestHandler.class));
    IRequestablePage page = ((RenderPageRequestHandler) handler).getPage();
    checkPage(page, 15);
    assertEquals(PAGE_CLASS_NAME, page.getClass().getSimpleName());
}
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 24 with IRequestablePage

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

the class PageInstanceMapperTest method decode10.

@Test
public void decode10() {
    final Url url = Url.parse("page?4");
    Request request = new Request() {

        @Override
        public Url getUrl() {
            return url;
        }

        @Override
        public Locale getLocale() {
            return null;
        }

        @Override
        public Charset getCharset() {
            return Charset.forName("UTF-8");
        }

        @Override
        public Url getClientUrl() {
            return Url.parse("page");
        }

        @Override
        public Object getContainerRequest() {
            return null;
        }
    };
    IRequestHandler handler = encoder.mapRequest(request);
    IRequestablePage page = ((IPageRequestHandler) handler).getPage();
    checkPage(page, 4);
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) Request(org.apache.wicket.request.Request) IRequestablePage(org.apache.wicket.request.component.IRequestablePage) IPageRequestHandler(org.apache.wicket.core.request.handler.IPageRequestHandler) Url(org.apache.wicket.request.Url) Test(org.junit.Test)

Example 25 with IRequestablePage

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

the class PageInstanceMapperTest method decode9.

@Test
public void decode9() {
    final Url url = Url.parse("page?4");
    Request request = new Request() {

        @Override
        public Url getUrl() {
            return url;
        }

        @Override
        public Locale getLocale() {
            return null;
        }

        @Override
        public Charset getCharset() {
            return Charset.forName("UTF-8");
        }

        @Override
        public Url getClientUrl() {
            return Url.parse("wicket/page");
        }

        @Override
        public Object getContainerRequest() {
            return null;
        }
    };
    IRequestHandler handler = encoder.mapRequest(request);
    IRequestablePage page = ((IPageRequestHandler) handler).getPage();
    checkPage(page, 4);
}
Also used : IRequestHandler(org.apache.wicket.request.IRequestHandler) Request(org.apache.wicket.request.Request) IRequestablePage(org.apache.wicket.request.component.IRequestablePage) IPageRequestHandler(org.apache.wicket.core.request.handler.IPageRequestHandler) 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