public class BookmarkableMapper extends AbstractBookmarkableMapper
Page Class - Render (BookmarkablePageRequestHandler) /wicket/bookmarkable/org.apache.wicket.MyPage (will redirect to hybrid alternative if page is not stateless) Page Instance - Render Hybrid (RenderPageRequestHandler for pages that were created using bookmarkable URLs) /wicket/bookmarkable/org.apache.wicket.MyPage?2 Page Instance - Bookmarkable Listener (BookmarkableListenerRequestHandler) /wicket/bookmarkable/org.apache.wicket.MyPage?2-click-foo-bar-baz /wicket/bookmarkable/org.apache.wicket.MyPage?2-click.1-foo-bar-baz (1 is behavior index) (these will redirect to hybrid if page is not stateless)
AbstractBookmarkableMapper.MountPathSegment, AbstractBookmarkableMapper.UrlInfo
mountSegments, pageParametersEncoder, pathSegments
Constructor and Description |
---|
BookmarkableMapper()
Construct.
|
BookmarkableMapper(IPageParametersEncoder pageParametersEncoder)
Construct.
|
Modifier and Type | Method and Description |
---|---|
protected Url |
buildUrl(AbstractBookmarkableMapper.UrlInfo info)
Builds URL for the given
AbstractBookmarkableMapper.UrlInfo instance. |
int |
getCompatibilityScore(Request request)
Returns the score representing how compatible this request mapper is to processing the given
request.
|
protected boolean |
pageMustHaveBeenCreatedBookmarkable()
Indicates whether hybrid
RenderPageRequestHandler 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 an
AbstractBookmarkableMapper.UrlInfo instance. |
protected boolean |
urlStartsWithAndHasPageClass(Url url,
String... segments)
Checks whether the url starts with the given segments and additionally
checks whether the following segment is non-empty
|
checkPageClass, checkPageInstance, extractPageParameters, getMatchedSegmentSizes, getPageInfo, getPathSegments, isCaseSensitiveMatch, isFixedSegment, mapHandler, mapRequest, newPageParameters, processBookmarkable, processHybrid, processListener, resolveUserLocale, segmentsMatch, setCaseSensitiveMatch, setPlaceholders, urlStartsWithMountedSegments
cleanClassName, encodePageComponentInfo, getContext, getPageClass, getPageComponentInfo, removeMetaParameter
encodePageParameters, extractPageParameters, getMountSegments, getOptionalPlaceholder, getPlaceholder, getPlaceholder, resolveLocale, safeSegmentGetter, urlStartsWith
public BookmarkableMapper()
public BookmarkableMapper(IPageParametersEncoder pageParametersEncoder)
pageParametersEncoder
- protected Url buildUrl(AbstractBookmarkableMapper.UrlInfo info)
AbstractBookmarkableMapper
AbstractBookmarkableMapper.UrlInfo
instance. The URL this method produces must be
parseable by the AbstractBookmarkableMapper.parseRequest(Request)
method.buildUrl
in class AbstractBookmarkableMapper
protected AbstractBookmarkableMapper.UrlInfo parseRequest(Request request)
AbstractBookmarkableMapper
AbstractBookmarkableMapper.UrlInfo
instance.parseRequest
in class AbstractBookmarkableMapper
null
if this encoder can not handle the requestprotected boolean pageMustHaveBeenCreatedBookmarkable()
AbstractBookmarkableMapper
RenderPageRequestHandler
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 return false
pageMustHaveBeenCreatedBookmarkable
in class AbstractBookmarkableMapper
true
if hybrid URL requires page created bookmarkable,
false
otherwise.public int getCompatibilityScore(Request request)
IRequestMapper
A good criteria for calculating the score is the number of matched url segments. For example
when there are two mappers for a mounted page, one mapped to /foo
another to
/foo/bar
and the incoming request URL is /foo/bar/baz, the mapping
to /foo/bar
should probably handle the request first as it has matching segments
count of 2 while the first one has only matching segments count of 1.
Note that the method can return value greater then zero even if the mapper does not recognize the request.
getCompatibilityScore
in interface IRequestMapper
getCompatibilityScore
in class AbstractBookmarkableMapper
protected boolean urlStartsWithAndHasPageClass(Url url, String... segments)
url
- The url to be checkedsegments
- The expected leading segmentstrue
if the url starts with the given segments and there is non-empty segment after themCopyright © 2006–2022 Apache Software Foundation. All rights reserved.