public class BasicResourceReferenceMapper extends AbstractResourceReferenceMapper
ResourceReference
encoder that encodes and decodes non-mounted
ResourceReference
s.
Decodes and encodes the following URLs:
/wicket/resource/org.apache.wicket.ResourceScope/name /wicket/resource/org.apache.wicket.ResourceScope/name?en /wicket/resource/org.apache.wicket.ResourceScope/name?-style /wicket/resource/org.apache.wicket.ResourceScope/resource/name.xyz?en_EN-style
Modifier and Type | Field and Description |
---|---|
protected Supplier<? extends IResourceCachingStrategy> |
cachingStrategy
resource caching strategy
|
protected IPageParametersEncoder |
pageParametersEncoder |
Constructor and Description |
---|
BasicResourceReferenceMapper(IPageParametersEncoder pageParametersEncoder,
Supplier<? extends IResourceCachingStrategy> cachingStrategy)
Construct.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
canBeHandled(Url url)
Checks whether the passed Url can be handled by this mapper
|
protected IResourceCachingStrategy |
getCachingStrategy() |
protected String |
getClassName(Class<?> scope) |
int |
getCompatibilityScore(Request request)
Returns the score representing how compatible this request mapper is to processing the given
request.
|
Url |
mapHandler(IRequestHandler requestHandler)
|
IRequestHandler |
mapRequest(Request request)
|
protected Class<?> |
resolveClass(String name) |
removeMetaParameter
cleanClassName, encodePageComponentInfo, getContext, getPageClass, getPageComponentInfo
encodePageParameters, extractPageParameters, getMountSegments, getOptionalPlaceholder, getPlaceholder, getPlaceholder, resolveLocale, safeSegmentGetter, urlStartsWith
protected final IPageParametersEncoder pageParametersEncoder
protected final Supplier<? extends IResourceCachingStrategy> cachingStrategy
public BasicResourceReferenceMapper(IPageParametersEncoder pageParametersEncoder, Supplier<? extends IResourceCachingStrategy> cachingStrategy)
pageParametersEncoder
- cachingStrategy
- public IRequestHandler mapRequest(Request request)
IRequestMapper
request
- provides access to request data (i.e. Url and Parameters)null
protected final IResourceCachingStrategy getCachingStrategy()
public Url mapHandler(IRequestHandler requestHandler)
IRequestMapper
null
.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.
protected boolean canBeHandled(Url url)
url
- the Url to checktrue
- if the Url can be handled, false
- otherwiseCopyright © 2006–2022 Apache Software Foundation. All rights reserved.