public class ResourceMapper extends AbstractBookmarkableMapper
IRequestMapper
to mount resources to a custom mount path
/myresources/${category}/images/[indexed-param-0]/[indexed-param-1]?[named-param-1=value]&[named-param-2=value2]
mountResource("/images", new ImagesResourceReference()));Note: Mounted this way the resource reference has application scope, i.e. it is shared between all users of the application. It is recommended to not keep any state in it.
WebApplication.mountResource(String,
org.apache.wicket.request.resource.ResourceReference)
AbstractBookmarkableMapper.MountPathSegment, AbstractBookmarkableMapper.UrlInfo
pageParametersEncoder, pathSegments
Constructor and Description |
---|
ResourceMapper(String path,
ResourceReference resourceReference)
create a resource mapper for a resource
|
ResourceMapper(String path,
ResourceReference resourceReference,
IPageParametersEncoder encoder)
create a resource mapper for a resource
|
Modifier and Type | Method and Description |
---|---|
protected void |
addCachingDecoration(Url url,
PageParameters parameters) |
protected Url |
buildUrl(AbstractBookmarkableMapper.UrlInfo info)
Builds URL for the given
AbstractBookmarkableMapper.UrlInfo instance. |
protected IResourceCachingStrategy |
getCachingStrategy() |
int |
getCompatibilityScore(Request request) |
Url |
mapHandler(IRequestHandler requestHandler) |
IRequestHandler |
mapRequest(Request 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 void |
removeCachingDecoration(Url url,
PageParameters parameters) |
checkPageClass, checkPageInstance, extractPageParameters, getMatchedSegmentSizes, getPageInfo, getPathSegments, isCaseSensitiveMatch, isFixedSegment, processBookmarkable, processHybrid, processListener, segmentsMatch, setCaseSensitiveMatch, setPlaceholders, urlStartsWithMountedSegments
cleanClassName, encodePageComponentInfo, getContext, getPageClass, getPageComponentInfo, removeMetaParameter, requestListenerInterfaceFromString, requestListenerInterfaceToString
encodePageParameters, extractPageParameters, getMountSegments, getOptionalPlaceholder, getPlaceholder, getPlaceholder, safeSegmentGetter, urlStartsWith
public ResourceMapper(String path, ResourceReference resourceReference)
path
- mount path for the resourceresourceReference
- resource reference that should be linked to the mount pathResourceMapper(String, org.apache.wicket.request.resource.ResourceReference,
org.apache.wicket.request.mapper.parameter.IPageParametersEncoder)
public ResourceMapper(String path, ResourceReference resourceReference, IPageParametersEncoder encoder)
path
- mount path for the resourceresourceReference
- resource reference that should be linked to the mount pathencoder
- encoder for url parameterspublic IRequestHandler mapRequest(Request request)
mapRequest
in interface IRequestMapper
mapRequest
in class AbstractBookmarkableMapper
protected final AbstractBookmarkableMapper.UrlInfo parseRequest(Request request)
AbstractBookmarkableMapper
AbstractBookmarkableMapper.UrlInfo
instance.parseRequest
in class AbstractBookmarkableMapper
null
if this encoder can not handle the requestprotected final 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 final 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)
getCompatibilityScore
in interface IRequestMapper
getCompatibilityScore
in class AbstractBookmarkableMapper
public Url mapHandler(IRequestHandler requestHandler)
mapHandler
in interface IRequestMapper
mapHandler
in class AbstractBookmarkableMapper
protected IResourceCachingStrategy getCachingStrategy()
protected void addCachingDecoration(Url url, PageParameters parameters)
protected void removeCachingDecoration(Url url, PageParameters parameters)
Copyright © 2006–2017 Apache Software Foundation. All rights reserved.