Search in sources :

Example 1 with MountedMapper

use of org.apache.wicket.core.request.mapper.MountedMapper in project wicket by apache.

the class NiceUrlApplication method init.

@Override
protected void init() {
    super.init();
    // mount single bookmarkable pages
    mountPage("/the/homepage/path", Home.class);
    mountPage("/a/nice/path/to/the/first/page", Page1.class);
    mountPage("/path/to/page2", Page2.class);
    mountPage("/path/to/page2pp/#{param1}/#{param2}", Page2PP.class);
    mount(new MountedMapper("/path/to/page2up", Page2UP.class, new UrlPathPageParametersEncoder()));
    // mount a whole package at once (all bookmarkable pages,
    // the relative class name will be part of the url
    // for package mounting it makes sense to use one of
    // the (important) classes in your package, so
    // that any refactoring (like a package rename) will automatically
    // be applied here.
    mountPackage("/my/mounted/package", Page3.class);
}
Also used : MountedMapper(org.apache.wicket.core.request.mapper.MountedMapper) UrlPathPageParametersEncoder(org.apache.wicket.request.mapper.parameter.UrlPathPageParametersEncoder)

Example 2 with MountedMapper

use of org.apache.wicket.core.request.mapper.MountedMapper in project wicket by apache.

the class WebApplication method mountPage.

/**
 * Mounts a page class to the given path.
 *
 * <p>
 * NOTE: mount path must not start with reserved URL segments! See {@link IMapperContext} to know
 * which segments are reserved for internal use.
 * </p>
 * @param <T>
 *            type of page
 *
 * @param path
 *            the path to mount the page class on
 * @param pageClass
 *            the page class to be mounted
 */
public <T extends Page> MountedMapper mountPage(final String path, final Class<T> pageClass) {
    MountedMapper mapper = new MountedMapper(path, pageClass);
    mount(mapper);
    return mapper;
}
Also used : MountedMapper(org.apache.wicket.core.request.mapper.MountedMapper)

Example 3 with MountedMapper

use of org.apache.wicket.core.request.mapper.MountedMapper in project wicket by apache.

the class RequestMapperApplication method init.

@Override
public void init() {
    super.init();
    getRootRequestMapperAsCompound().add(new CustomHomeMapper(getHomePage()));
    getRootRequestMapperAsCompound().add(new LocaleFirstMapper(new MountedMapper("/localized", LocalizedPage.class)));
    mountPage("secured", HttpsPage.class);
    mountPackage("pMount", PackageMountedPage.class);
    mountResource("/print/${sheet}/${format}", new MapperDemoResourceReference());
    setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new LazyHttpsConfig()));
}
Also used : HttpsMapper(org.apache.wicket.protocol.https.HttpsMapper) MountedMapper(org.apache.wicket.core.request.mapper.MountedMapper)

Example 4 with MountedMapper

use of org.apache.wicket.core.request.mapper.MountedMapper in project wicket by apache.

the class ConversationPropagatorTest method testPropagationAllHybrid.

@Test
public void testPropagationAllHybrid() {
    configure(new CdiConfiguration().setPropagation(ConversationPropagation.ALL));
    tester.getApplication().getRootRequestMapperAsCompound().add(new MountedMapper("segment/${pageType}", TestConversationPage.class));
    tester.startPage(TestConversationPage.class, new PageParameters().add("pageType", "hybrid"));
    int i;
    for (i = 0; i < 3; i++) {
        tester.assertCount(i);
        tester.clickLink("increment");
    }
    tester.clickLink("next");
    for (; i < 6; i++) {
        tester.assertCount(i);
        tester.clickLink("increment");
    }
}
Also used : TestConversationPage(org.apache.wicket.cdi.testapp.TestConversationPage) MountedMapper(org.apache.wicket.core.request.mapper.MountedMapper) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) Test(org.junit.Test)

Example 5 with MountedMapper

use of org.apache.wicket.core.request.mapper.MountedMapper in project wicket by apache.

the class ListenerRequestHandlerTest method executeStatelessLinkInAFreshPageAtASegment.

@Test
public void executeStatelessLinkInAFreshPageAtASegment() {
    tester.getApplication().getRootRequestMapperAsCompound().add(new MountedMapper("/segment", TemporarilyStateful.class));
    tester.startPage(TemporarilyStateful.class);
    tester.clickLink("statelessLink");
    TemporarilyStateful page = (TemporarilyStateful) tester.getLastRenderedPage();
    assertThat(page.invoked, is(true));
    assertThat(page.executedInAnFreshPage, is(true));
}
Also used : MountedMapper(org.apache.wicket.core.request.mapper.MountedMapper) Test(org.junit.Test)

Aggregations

MountedMapper (org.apache.wicket.core.request.mapper.MountedMapper)9 Test (org.junit.Test)4 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)3 TestConversationPage (org.apache.wicket.cdi.testapp.TestConversationPage)2 MidPointApplicationConfiguration (com.evolveum.midpoint.gui.api.util.MidPointApplicationConfiguration)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 PageMounter (com.evolveum.midpoint.web.application.PageMounter)1 MidPointResourceStreamLocator (com.evolveum.midpoint.web.util.MidPointResourceStreamLocator)1 MidPointStringResourceLoader (com.evolveum.midpoint.web.util.MidPointStringResourceLoader)1 SystemConfigurationType (com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType)1 ServletContext (javax.servlet.ServletContext)1 AbstractDefaultAjaxBehavior (org.apache.wicket.ajax.AbstractDefaultAjaxBehavior)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 AjaxRequestAttributes (org.apache.wicket.ajax.attributes.AjaxRequestAttributes)1 IResourceStreamLocator (org.apache.wicket.core.util.resource.locator.IResourceStreamLocator)1 CachingResourceStreamLocator (org.apache.wicket.core.util.resource.locator.caching.CachingResourceStreamLocator)1 InspectorPage (org.apache.wicket.devutils.inspector.InspectorPage)1 LiveSessionsPage (org.apache.wicket.devutils.inspector.LiveSessionsPage)1 PageStorePage (org.apache.wicket.devutils.pagestore.PageStorePage)1 PriorityFirstComparator (org.apache.wicket.markup.head.PriorityFirstComparator)1