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);
}
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;
}
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()));
}
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");
}
}
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));
}
Aggregations