java.lang.Object
org.apache.wicket.request.mapper.AbstractMapper
- All Implemented Interfaces:
IRequestMapper
- Direct Known Subclasses:
AbstractComponentMapper
,ReportCSPViolationMapper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Url
encodePageParameters
(Url url, PageParameters pageParameters, IPageParametersEncoder encoder) Encodes the givenPageParameters
to the URL using the givenIPageParametersEncoder
.protected PageParameters
extractPageParameters
(Request request, int segmentsToSkip, IPageParametersEncoder encoder) ExtractsPageParameters
from the URL using the givenIPageParametersEncoder
.protected String[]
getMountSegments
(String mountPath) Convenience method for representing mountPath as array of segmentsprotected String
If the string is in an optional parameter placeholder format #{key} this method returns the key.protected String
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 newIRequestMapper
s use the first query parameter to hold meta information about the request like page version, component version, locale, ...protected Locale
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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.wicket.request.IRequestMapper
getCompatibilityScore, mapHandler, mapRequest
-
Constructor Details
-
AbstractMapper
public AbstractMapper()Construct.
-
-
Method Details
-
getPlaceholder
If the string is in a placeholder format ${key} this method returns the key.- Parameters:
s
-- Returns:
- placeholder key or
null
if string is not in right format
-
getOptionalPlaceholder
If the string is in an optional parameter placeholder format #{key} this method returns the key.- Parameters:
s
-- Returns:
- placeholder key or
null
if string is not in right format
-
getPlaceholder
If the string is in a placeholder format x{key}, where 'x' can be specified, this method returns the key.- Parameters:
s
-startChar
- the character used to indicate the start of the placeholder- Returns:
- placeholder key or
null
if string is not in right format
-
urlStartsWith
Returns true if the given url starts with specified segments.- Parameters:
url
-segments
-- Returns:
true
if the URL starts with the specified segments,false
otherwise
-
safeSegmentGetter
Utility method to safely get an element from a list of String. If the specified index is bigger than the size of the list the default value is returned.- Parameters:
segments
-index
-defaultValue
-- Returns:
- the element at the specified position or the default value if the list size is smaller.
-
extractPageParameters
protected PageParameters extractPageParameters(Request request, int segmentsToSkip, IPageParametersEncoder encoder) ExtractsPageParameters
from the URL using the givenIPageParametersEncoder
.- Parameters:
request
-segmentsToSkip
- how many URL segments should be skipped because they "belong" to theIRequestMapper
encoder
-- Returns:
- PageParameters instance
-
removeMetaParameter
The newIRequestMapper
s use the first query parameter to hold meta information about the request like page version, component version, locale, ... The actualIRequestMapper
implementation can decide whether the this parameter should be removed before creatingPageParameters
from the currentquery parameters
- Parameters:
urlCopy
- theUrl
that first query parameter has no value
-
encodePageParameters
protected Url encodePageParameters(Url url, PageParameters pageParameters, IPageParametersEncoder encoder) Encodes the givenPageParameters
to the URL using the givenIPageParametersEncoder
. The original URL object is unchanged.- Parameters:
url
-pageParameters
-encoder
-- Returns:
- URL with encoded parameters
-
getMountSegments
Convenience method for representing mountPath as array of segments- Parameters:
mountPath
-- Returns:
- array of path segments
-
resolveLocale
- Returns:
- the locale to use for parsing any numbers in the request parameters
-