Request mappingPage edited by Martin Grigorov
Comment:
Fix the demos
Changes (2)
Full ContentHow it was in Wicket 1.4To mount a page in Wicket 1.4 the developer had to use org.apache.wicket.protocol.http.WebApplication's:
The new way in Wicket 1.5org.apache.wicket.request.target.coding.IRequestTargetUrlCodingStrategy interface and all its implementations are replaced with the org.apache.wicket.request.IRequestMapper and its respective implementations. Default mapper implementationsHomePageMapperThis mapper is pre-configured by Wicket and there is no need to register it. It is used to create IRequestHandler for requests to the root ('/') of the application context. BookmarkableMapperThis mapper decodes and encodes bookmarkable URLs like:
This mapper is also pre-configured and there is no need to register it. MountedMapperThis mapper is similar to BookmarkableMapper but the difference is that the user application defines the mount point where this mapper matches.
Usage: MyApp.java: public void init() { super.init(); getRootRequestMapperAsCompound().add(new MountedMapper("/mount/point", MyPage.class)); mountPage("/mount/point", MyPage.class); // convenient method doing the same as above } PackageMapperThis mapper can mount a whole package. That is you mount a single page with a mount path prefix and then the mapper knows how to map all Page implementations in that package. Usage: MyApp.java: public void init() { super.init(); getRootRequestMapperAsCompound().add( new MountMapper("/mount/point", new PackageMapper( PackageName.forClass(Page3.class)))); mountPackage("/mount/point", Page3.class); } Assuming that PageA package is "com.example.pages" a request to "/mount/point/PageB" will use com.example.pages.PageB if it exists and is an instance of Page. ResourceMapperA mapper which mounts ResourceReference implementations. Usage: MyApp.java: public void init() { super.init(); getRootRequestMapperAsCompound().add(new ResourceMapper("/company/logo", new PackageResourceReference(MyPage.class, "res/logo.gif"))); mountResource("/company/logo", new PackageResourceReference(MyPage.class, "res/logo.gif"))); // convenient method doing the same as above } CryptoMapperA wrapper around another mapper which will encrypt/decrypt the URLs generated by the inner one. Usage: public void init() { super.init(); IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(), this)); setRootRequestMapper(cryptoMapper); } HttpsMapperA mapper which makes a redirect to the same URL with HTTPS protocol if the requested page is annotated with @RequireHttps or to HTTP protocol if the last processed page had @RequireHttps and the one going to be processed has no such annotation. Usage: public class MyApplication extends WebApplication { public void init() { super.init(); getRootRequestMapperAsCompound().add(new MountedMapper("secured", HttpsPage.class)); setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), new HttpsConfig(80, 443))); } }
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] Apache Wicket > Request mapping confluence
- [CONF] Apache Wicket > Request mapping confluence
- [CONF] Apache Wicket > Request mapping confluence
- [CONF] Apache Wicket > Request mapping confluence
