public abstract class AbstractBookmarkableMapper extends AbstractComponentMapper
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractBookmarkableMapper.MountPathSegment |
protected static class |
AbstractBookmarkableMapper.UrlInfo
Represents information stored in URL.
|
Modifier and Type | Field and Description |
---|---|
protected String[] |
mountSegments |
protected IPageParametersEncoder |
pageParametersEncoder |
protected List<AbstractBookmarkableMapper.MountPathSegment> |
pathSegments |
Constructor and Description |
---|
AbstractBookmarkableMapper()
Construct.
|
AbstractBookmarkableMapper(String mountPath,
IPageParametersEncoder pageParametersEncoder) |
Modifier and Type | Method and Description |
---|---|
protected abstract Url |
buildUrl(AbstractBookmarkableMapper.UrlInfo info)
Builds URL for the given
AbstractBookmarkableMapper.UrlInfo instance. |
protected boolean |
checkPageClass(Class<? extends IRequestablePage> pageClass) |
protected boolean |
checkPageInstance(IRequestablePage page) |
protected PageParameters |
extractPageParameters(Request request,
Url url)
Extracts the PageParameters from URL if there are any
|
int |
getCompatibilityScore(Request request) |
protected int[] |
getMatchedSegmentSizes(Url url) |
protected PageInfo |
getPageInfo(IPageRequestHandler handler) |
protected List<AbstractBookmarkableMapper.MountPathSegment> |
getPathSegments(String[] segments) |
protected boolean |
isCaseSensitiveMatch() |
protected boolean |
isFixedSegment(String segment) |
Url |
mapHandler(IRequestHandler requestHandler) |
IRequestHandler |
mapRequest(Request request) |
protected abstract boolean |
pageMustHaveBeenCreatedBookmarkable()
Indicates whether hybrid
RenderPageRequestHandler URL for page will be generated only
if page has been created with bookmarkable URL. |
protected abstract AbstractBookmarkableMapper.UrlInfo |
parseRequest(Request request)
Parse the given request to an
AbstractBookmarkableMapper.UrlInfo instance. |
protected IRequestHandler |
processBookmarkable(Class<? extends IRequestablePage> pageClass,
PageParameters pageParameters)
Creates a
IRequestHandler that processes a bookmarkable request. |
protected IRequestHandler |
processHybrid(PageInfo pageInfo,
Class<? extends IRequestablePage> pageClass,
PageParameters pageParameters,
Integer renderCount)
Creates a
IRequestHandler that processes a hybrid request. |
protected IRequestHandler |
processListener(PageComponentInfo pageComponentInfo,
Class<? extends IRequestablePage> pageClass,
PageParameters pageParameters)
Creates a
IRequestHandler that processes a listener request. |
protected boolean |
segmentsMatch(String mountedSegment,
String urlSegment)
Decides whether a segment from the mounted path matches with a segment
from the requested url.
|
AbstractBookmarkableMapper |
setCaseSensitiveMatch(boolean isCaseSensitive)
Sets whether the matching of mounted segments against request's url ones should be
case sensitive or not.
|
protected boolean |
setPlaceholders(PageParameters parameters,
Url url)
Replaces mandatory and optional parameters with their values.
|
protected boolean |
urlStartsWithMountedSegments(Url url) |
cleanClassName, encodePageComponentInfo, getContext, getPageClass, getPageComponentInfo, removeMetaParameter, requestListenerInterfaceFromString, requestListenerInterfaceToString
encodePageParameters, extractPageParameters, getMountSegments, getOptionalPlaceholder, getPlaceholder, getPlaceholder, safeSegmentGetter, urlStartsWith
protected final List<AbstractBookmarkableMapper.MountPathSegment> pathSegments
protected final String[] mountSegments
protected final IPageParametersEncoder pageParametersEncoder
public AbstractBookmarkableMapper()
public AbstractBookmarkableMapper(String mountPath, IPageParametersEncoder pageParametersEncoder)
protected abstract AbstractBookmarkableMapper.UrlInfo parseRequest(Request request)
AbstractBookmarkableMapper.UrlInfo
instance.request
- null
if this encoder can not handle the requestprotected abstract Url buildUrl(AbstractBookmarkableMapper.UrlInfo info)
AbstractBookmarkableMapper.UrlInfo
instance. The URL this method produces must be
parseable by the parseRequest(Request)
method.info
- protected abstract boolean pageMustHaveBeenCreatedBookmarkable()
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
true
if hybrid URL requires page created bookmarkable,
false
otherwise.public int getCompatibilityScore(Request request)
protected IRequestHandler processBookmarkable(Class<? extends IRequestablePage> pageClass, PageParameters pageParameters)
IRequestHandler
that processes a bookmarkable request.pageClass
- pageParameters
- IRequestHandler
capable of processing the bookmarkable request.protected IRequestHandler processHybrid(PageInfo pageInfo, Class<? extends IRequestablePage> pageClass, PageParameters pageParameters, Integer renderCount)
IRequestHandler
that processes a hybrid request. When the page identified
by pageInfo
was not available, the request should be treated as a bookmarkable
request.pageInfo
- pageClass
- pageParameters
- renderCount
- IRequestHandler
capable of processing the hybrid request.protected IRequestHandler processListener(PageComponentInfo pageComponentInfo, Class<? extends IRequestablePage> pageClass, PageParameters pageParameters)
IRequestHandler
that processes a listener request.pageComponentInfo
- pageClass
- pageParameters
- IRequestHandler
that invokes the listener interfacepublic IRequestHandler mapRequest(Request request)
protected boolean checkPageInstance(IRequestablePage page)
protected boolean checkPageClass(Class<? extends IRequestablePage> pageClass)
public Url mapHandler(IRequestHandler requestHandler)
protected final PageInfo getPageInfo(IPageRequestHandler handler)
protected List<AbstractBookmarkableMapper.MountPathSegment> getPathSegments(String[] segments)
protected boolean isFixedSegment(String segment)
protected PageParameters extractPageParameters(Request request, Url url)
protected int[] getMatchedSegmentSizes(Url url)
protected boolean segmentsMatch(String mountedSegment, String urlSegment)
mountedSegment
- the segment from the mounted pathurlSegment
- the segment from the request urltrue
if the segments matchprotected boolean isCaseSensitiveMatch()
public AbstractBookmarkableMapper setCaseSensitiveMatch(boolean isCaseSensitive)
isCaseSensitive
- a flag indicating whether the matching of mounted segments against request's
url ones should be case sensitive or notprotected boolean setPlaceholders(PageParameters parameters, Url url)
false
indicating that there is a problem.
Optional parameters with missing values are just dropped.parameters
- The parameters with the valuesurl
- The url with the placeholderstrue
if all mandatory parameters are properly substituted,
false
- otherwiseprotected boolean urlStartsWithMountedSegments(Url url)
Copyright © 2006–2016 Apache Software Foundation. All rights reserved.