org.apache.wicket.request.mapper
Class AbstractMapper

java.lang.Object
  extended by org.apache.wicket.request.mapper.AbstractMapper
All Implemented Interfaces:
IRequestMapper
Direct Known Subclasses:
AbstractComponentMapper, MountMapper, ResourceMapper

public abstract class AbstractMapper
extends java.lang.Object
implements IRequestMapper


Constructor Summary
AbstractMapper()
          Construct.
 
Method Summary
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  java.lang.String[] getMountSegments(java.lang.String mountPath)
          Convenience method for representing mountPath as array of segments
protected  java.lang.String getOptionalPlaceholder(java.lang.String s)
          If the string is in an optional parameter placeholder format #{key} this method returns the key.
protected  java.lang.String getPlaceholder(java.lang.String s)
          If the string is in a placeholder format ${key} this method returns the key.
protected  java.lang.String getPlaceholder(java.lang.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 IRequestMappers use the first query parameter to hold meta information about the request like page version, component version, locale, ...
protected  boolean urlStartsWith(Url url, java.lang.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 Detail

AbstractMapper

public AbstractMapper()
Construct.

Method Detail

getPlaceholder

protected java.lang.String getPlaceholder(java.lang.String s)
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

protected java.lang.String getOptionalPlaceholder(java.lang.String s)
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

protected java.lang.String getPlaceholder(java.lang.String s,
                                          char startChar)
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

protected boolean urlStartsWith(Url url,
                                java.lang.String... segments)
Returns true if the given url starts with specified segments. Segments that contain placelhoders are not compared.

Parameters:
url -
segments -
Returns:
true if the URL starts with the specified segments, false otherwise

extractPageParameters

protected PageParameters extractPageParameters(Request request,
                                               int segmentsToSkip,
                                               IPageParametersEncoder encoder)
Extracts PageParameters from the URL using the given IPageParametersEncoder .

Parameters:
request -
segmentsToSkip - how many URL segments should be skipped because they "belong" to the IRequestMapper
encoder -
Returns:
PageParameters instance

removeMetaParameter

protected void removeMetaParameter(Url urlCopy)
The new IRequestMappers 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

Parameters:
urlCopy - the Url that first query parameter has no value

encodePageParameters

protected Url encodePageParameters(Url url,
                                   PageParameters pageParameters,
                                   IPageParametersEncoder encoder)
Encodes the given PageParameters to the URL using the given IPageParametersEncoder. The original URL object is unchanged.

Parameters:
url -
pageParameters -
encoder -
Returns:
URL with encoded parameters

getMountSegments

protected java.lang.String[] getMountSegments(java.lang.String mountPath)
Convenience method for representing mountPath as array of segments

Parameters:
mountPath -
Returns:
array of path segments


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.