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.PackageMapper
- All Implemented Interfaces:
IRequestMapper
A request mapper that mounts all bookmarkable pages in a given package.
To mount this mapper onto a path use the WebApplication.mountPackage(String, Class)
, ex:
MyApp#init() { super.init(); mountPackage("/my/path", MyPage.class); }will result in urls like
/my/path/MyPage
Page Class - Render (BookmarkablePageRequestHandler) /MyPage (will redirect to hybrid alternative if page is not stateless) Page Instance - Render Hybrid (RenderPageRequestHandler for pages that were created using bookmarkable URLs) /MyPage?2 Page Instance - Bookmarkable Listener (BookmarkableListenerRequestHandler) /MyPage?2-click-foo-bar-baz /MyPage?2-click.1-foo-bar-baz (1 is behavior index) (these will redirect to hybrid if page is not stateless)
-
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
ConstructorDescriptionPackageMapper
(String mountPath, PackageName packageName) Constructor.PackageMapper
(String mountPath, PackageName packageName, IPageParametersEncoder pageParametersEncoder) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected Url
Builds URL for the givenAbstractBookmarkableMapper.UrlInfo
instance.protected boolean
checkPageClass
(Class<? extends IRequestablePage> pageClass) protected boolean
Indicates whether hybridRenderPageRequestHandler
URL for page will be generated only if page has been created with bookmarkable URL.protected AbstractBookmarkableMapper.UrlInfo
parseRequest
(Request request) Parse the given request to anAbstractBookmarkableMapper.UrlInfo
instance.protected String
transformForUrl
(String className) Gives a chance to specializations of this mapper to transform the real class name to an alias which is prettier to represent in the Urlprotected String
transformFromUrl
(String classNameAlias) Gives a chance to specializations of this mapper to transform the alias of the class name to the real class nameMethods inherited from class org.apache.wicket.core.request.mapper.AbstractBookmarkableMapper
checkPageInstance, extractPageParameters, getCompatibilityScore, getMatchedSegmentSizes, getPageInfo, getPathSegments, isCaseSensitiveMatch, isFixedSegment, mapHandler, 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
Methods inherited from class org.apache.wicket.request.mapper.AbstractMapper
encodePageParameters, extractPageParameters, getMountSegments, getOptionalPlaceholder, getPlaceholder, getPlaceholder, resolveLocale, safeSegmentGetter, urlStartsWith
-
Constructor Details
-
PackageMapper
Constructor.- Parameters:
packageName
-
-
PackageMapper
public PackageMapper(String mountPath, PackageName packageName, IPageParametersEncoder pageParametersEncoder) Constructor.- Parameters:
packageName
-pageParametersEncoder
-
-
-
Method Details
-
buildUrl
Description copied from class:AbstractBookmarkableMapper
Builds URL for the givenAbstractBookmarkableMapper.UrlInfo
instance. The URL this method produces must be parseable by theAbstractBookmarkableMapper.parseRequest(Request)
method.- Specified by:
buildUrl
in classAbstractBookmarkableMapper
- Returns:
- Url result URL
-
parseRequest
Description copied from class:AbstractBookmarkableMapper
Parse the given request to anAbstractBookmarkableMapper.UrlInfo
instance.- Specified by:
parseRequest
in classAbstractBookmarkableMapper
- Returns:
- UrlInfo instance or
null
if this encoder can not handle the request
-
transformFromUrl
Gives a chance to specializations of this mapper to transform the alias of the class name to the real class name- Parameters:
classNameAlias
- the alias for the class name- Returns:
- the real class name
-
transformForUrl
Gives a chance to specializations of this mapper to transform the real class name to an alias which is prettier to represent in the Url- Parameters:
className
- the real class name- Returns:
- the class name alias
-
pageMustHaveBeenCreatedBookmarkable
Description copied from class:AbstractBookmarkableMapper
Indicates whether hybridRenderPageRequestHandler
URL 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:
pageMustHaveBeenCreatedBookmarkable
in classAbstractBookmarkableMapper
- Returns:
true
if hybrid URL requires page created bookmarkable,false
otherwise.
-
checkPageClass
- Overrides:
checkPageClass
in classAbstractBookmarkableMapper
-