java.lang.Object
org.apache.wicket.request.mapper.AbstractMapper
- All Implemented Interfaces:
IRequestMapper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected UrlencodePageParameters(Url url, PageParameters pageParameters, IPageParametersEncoder encoder) Encodes the givenPageParametersto the URL using the givenIPageParametersEncoder.protected PageParametersextractPageParameters(Request request, int segmentsToSkip, IPageParametersEncoder encoder) ExtractsPageParametersfrom the URL using the givenIPageParametersEncoder.protected String[]getMountSegments(String mountPath) Convenience method for representing mountPath as array of segmentsprotected StringIf the string is in an optional parameter placeholder format #{key} this method returns the key.protected StringIf the string is in a placeholder format ${key} this method returns the key.protected StringgetPlaceholder(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 voidremoveMetaParameter(Url urlCopy) The newIRequestMappers use the first query parameter to hold meta information about the request like page version, component version, locale, ...protected Localeprotected StringsafeSegmentGetter(List<String> segments, int index, String defaultValue) Utility method to safely get an element from a list of String.protected booleanurlStartsWith(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, waitMethods 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
nullif 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
nullif 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
nullif string is not in right format
-
urlStartsWith
Returns true if the given url starts with specified segments.- Parameters:
url-segments-- Returns:
trueif the URL starts with the specified segments,falseotherwise
-
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) ExtractsPageParametersfrom the URL using the givenIPageParametersEncoder.- Parameters:
request-segmentsToSkip- how many URL segments should be skipped because they "belong" to theIRequestMapperencoder-- Returns:
- PageParameters instance
-
removeMetaParameter
The newIRequestMappers use the first query parameter to hold meta information about the request like page version, component version, locale, ... The actualIRequestMapperimplementation can decide whether the this parameter should be removed before creatingPageParametersfrom the currentquery parameters- Parameters:
urlCopy- theUrlthat first query parameter has no value
-
encodePageParameters
protected Url encodePageParameters(Url url, PageParameters pageParameters, IPageParametersEncoder encoder) Encodes the givenPageParametersto 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
-