public abstract class AbstractMapper extends Object implements IRequestMapper
Constructor and Description |
---|
AbstractMapper()
Construct.
|
Modifier and Type | Method and Description |
---|---|
protected Url |
encodePageParameters(Url url,
PageParameters pageParameters,
IPageParametersEncoder encoder)
Encodes the given
PageParameters to the URL using the given
IPageParametersEncoder . |
protected PageParameters |
extractPageParameters(Request request,
int segmentsToSkip,
IPageParametersEncoder encoder)
Extracts
PageParameters from the URL using the given IPageParametersEncoder . |
protected String[] |
getMountSegments(String mountPath)
Convenience method for representing mountPath as array of segments
|
protected String |
getOptionalPlaceholder(String s)
If the string is in an optional parameter placeholder format #{key} this method returns the
key.
|
protected String |
getPlaceholder(String s)
If the string is in a placeholder format ${key} this method returns the key.
|
protected String |
getPlaceholder(String s,
char startChar)
If the string is in a placeholder format x{key}, where 'x' can be specified, this method
returns the key.
|
protected void |
removeMetaParameter(Url urlCopy)
The new
IRequestMapper s use the first query parameter to hold meta information about
the request like page version, component version, locale, ... |
protected Locale |
resolveLocale() |
protected String |
safeSegmentGetter(List<String> segments,
int index,
String defaultValue)
Utility method to safely get an element from a list of String.
|
protected boolean |
urlStartsWith(Url url,
String... segments)
Returns true if the given url starts with specified segments.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCompatibilityScore, mapHandler, mapRequest
protected String getPlaceholder(String s)
s
- null
if string is not in right formatprotected String getOptionalPlaceholder(String s)
s
- null
if string is not in right formatprotected String getPlaceholder(String s, char startChar)
s
- startChar
- the character used to indicate the start of the placeholdernull
if string is not in right formatprotected boolean urlStartsWith(Url url, String... segments)
url
- segments
- true
if the URL starts with the specified segments, false
otherwiseprotected String safeSegmentGetter(List<String> segments, int index, String defaultValue)
segments
- index
- defaultValue
- protected PageParameters extractPageParameters(Request request, int segmentsToSkip, IPageParametersEncoder encoder)
PageParameters
from the URL using the given IPageParametersEncoder
.request
- segmentsToSkip
- how many URL segments should be skipped because they "belong" to the
IRequestMapper
encoder
- protected void removeMetaParameter(Url urlCopy)
IRequestMapper
s use the first query parameter to hold meta information about
the request like page version, component version, locale, ... The actual
IRequestMapper
implementation can decide whether the this parameter should be removed
before creating PageParameters
from the current query
parameters
urlCopy
- the Url
that first query parameter has no valueprotected Url encodePageParameters(Url url, PageParameters pageParameters, IPageParametersEncoder encoder)
PageParameters
to the URL using the given
IPageParametersEncoder
. The original URL object is unchanged.url
- pageParameters
- encoder
- protected String[] getMountSegments(String mountPath)
mountPath
- protected Locale resolveLocale()
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.