Class MountedMapper
- java.lang.Object
-
- org.apache.wicket.request.mapper.AbstractMapper
-
- org.apache.wicket.core.request.mapper.AbstractComponentMapper
-
- org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper
-
- org.apache.wicket.core.request.mapper.MountedMapper
-
- All Implemented Interfaces:
org.apache.wicket.request.IRequestMapper
- Direct Known Subclasses:
HomePageMapper
public class MountedMapper extends AbstractBookmarkableMapper
Encoder for mounted URL. The mount path can contain parameter placeholders, i.e./mount/${foo}/path. In that case the appropriate segment from the URL will be accessible as named parameter "foo" in thePageParameters. Similarly when the URL is constructed, the second segment will contain the value of the "foo" named page parameter. Optional parameters are denoted by using a # instead of $:/mount/#{foo}/path/${bar}has an optionalfooparameter, a fixed/path/part and a requiredbarparameter. When in doubt, parameters are matched from left to right, where required parameters are matched before optional parameters, and optional parameters eager (from left to right).Decodes and encodes the following URLs:
Page Class - Render (BookmarkablePageRequestHandler for mounted pages) /mount/point (these will redirect to hybrid alternative if page is not stateless) IPage Instance - Render Hybrid (RenderPageRequestHandler for mounted pages) /mount/point?2 IPage Instance - Bookmarkable Listener (BookmarkableListenerRequestHandler for mounted pages) /mount/point?2-click-foo-bar-baz /mount/point?2-5.click.1-foo-bar-baz (1 is behavior index, 5 is render count) (these will redirect to hybrid if page is not stateless)
- Author:
- Matej Knopp
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper
AbstractBookmarkableMapper.MountPathSegment, AbstractBookmarkableMapper.UrlInfo
-
-
Field Summary
-
Fields inherited from class org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper
mountSegments, pageParametersEncoder, pathSegments
-
-
Constructor Summary
Constructors Constructor Description MountedMapper(java.lang.String mountPath, java.lang.Class<? extends IRequestablePage> pageClass)Construct.MountedMapper(java.lang.String mountPath, java.lang.Class<? extends IRequestablePage> pageClass, org.apache.wicket.request.mapper.parameter.IPageParametersEncoder pageParametersEncoder)Construct.MountedMapper(java.lang.String mountPath, java.util.function.Supplier<java.lang.Class<? extends IRequestablePage>> pageClassProvider)Construct.MountedMapper(java.lang.String mountPath, java.util.function.Supplier<java.lang.Class<? extends IRequestablePage>> pageClassProvider, org.apache.wicket.request.mapper.parameter.IPageParametersEncoder pageParametersEncoder)Construct.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.wicket.request.UrlbuildUrl(AbstractBookmarkableMapper.UrlInfo info)Builds URL for the givenAbstractBookmarkableMapper.UrlInfoinstance.protected booleancheckPageClass(java.lang.Class<? extends IRequestablePage> pageClass)org.apache.wicket.request.UrlmapHandler(org.apache.wicket.request.IRequestHandler requestHandler)protected booleanpageMustHaveBeenCreatedBookmarkable()Indicates whether hybridRenderPageRequestHandlerURL for page will be generated only if page has been created with bookmarkable URL.protected AbstractBookmarkableMapper.UrlInfoparseRequest(org.apache.wicket.request.Request request)Parse the given request to anAbstractBookmarkableMapper.UrlInfoinstance.protected booleanredirectFromHomePage()If this method returnstrueand application home page class is same as the class mounted with this encoder, request to home page will result in a redirect to the mounted path.java.lang.StringtoString()-
Methods inherited from class org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper
checkPageInstance, extractPageParameters, getCompatibilityScore, getMatchedSegmentSizes, getPageInfo, getPathSegments, isCaseSensitiveMatch, isFixedSegment, mapRequest, newPageParameters, processBookmarkable, processHybrid, processListener, resolveUserLocale, segmentsMatch, setCaseSensitiveMatch, setPlaceholders, urlStartsWithMountedSegments
-
Methods inherited from class org.apache.wicket.core.request.mapper.AbstractComponentMapper
cleanClassName, encodePageComponentInfo, getContext, getPageClass, getPageComponentInfo, removeMetaParameter
-
-
-
-
Constructor Detail
-
MountedMapper
public MountedMapper(java.lang.String mountPath, java.lang.Class<? extends IRequestablePage> pageClass)Construct.- Parameters:
mountPath-pageClass-
-
MountedMapper
public MountedMapper(java.lang.String mountPath, java.util.function.Supplier<java.lang.Class<? extends IRequestablePage>> pageClassProvider)Construct.- Parameters:
mountPath-pageClassProvider-
-
MountedMapper
public MountedMapper(java.lang.String mountPath, java.lang.Class<? extends IRequestablePage> pageClass, org.apache.wicket.request.mapper.parameter.IPageParametersEncoder pageParametersEncoder)Construct.- Parameters:
mountPath-pageClass-pageParametersEncoder-
-
MountedMapper
public MountedMapper(java.lang.String mountPath, java.util.function.Supplier<java.lang.Class<? extends IRequestablePage>> pageClassProvider, org.apache.wicket.request.mapper.parameter.IPageParametersEncoder pageParametersEncoder)Construct.- Parameters:
mountPath-pageClassProvider-pageParametersEncoder-
-
-
Method Detail
-
parseRequest
protected AbstractBookmarkableMapper.UrlInfo parseRequest(org.apache.wicket.request.Request request)
Description copied from class:AbstractBookmarkableMapperParse the given request to anAbstractBookmarkableMapper.UrlInfoinstance.- Specified by:
parseRequestin classAbstractBookmarkableMapper- Returns:
- UrlInfo instance or
nullif this encoder can not handle the request
-
mapHandler
public org.apache.wicket.request.Url mapHandler(org.apache.wicket.request.IRequestHandler requestHandler)
- Specified by:
mapHandlerin interfaceorg.apache.wicket.request.IRequestMapper- Overrides:
mapHandlerin classAbstractBookmarkableMapper
-
buildUrl
protected org.apache.wicket.request.Url buildUrl(AbstractBookmarkableMapper.UrlInfo info)
Description copied from class:AbstractBookmarkableMapperBuilds URL for the givenAbstractBookmarkableMapper.UrlInfoinstance. The URL this method produces must be parseable by theAbstractBookmarkableMapper.parseRequest(Request)method.- Specified by:
buildUrlin classAbstractBookmarkableMapper- Returns:
- Url result URL
- See Also:
AbstractBookmarkableMapper.buildUrl(AbstractBookmarkableMapper.UrlInfo)
-
redirectFromHomePage
protected boolean redirectFromHomePage()
If this method returnstrueand application home page class is same as the class mounted with this encoder, request to home page will result in a redirect to the mounted path.- Returns:
- whether this encode should respond to home page request when home page class is same as mounted class.
-
pageMustHaveBeenCreatedBookmarkable
protected boolean pageMustHaveBeenCreatedBookmarkable()
Description copied from class:AbstractBookmarkableMapperIndicates whether hybridRenderPageRequestHandlerURL for page will be generated only if page has been created with bookmarkable URL.For generic bookmarkable encoders this method should return
true. For explicit (mounted) encoders this method should returnfalse- Specified by:
pageMustHaveBeenCreatedBookmarkablein classAbstractBookmarkableMapper- Returns:
trueif hybrid URL requires page created bookmarkable,falseotherwise.- See Also:
AbstractBookmarkableMapper.pageMustHaveBeenCreatedBookmarkable()
-
checkPageClass
protected boolean checkPageClass(java.lang.Class<? extends IRequestablePage> pageClass)
- Overrides:
checkPageClassin classAbstractBookmarkableMapper- See Also:
AbstractBookmarkableMapper.checkPageClass(java.lang.Class)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-