org.apache.wicket.request.target.coding
Class AbstractRequestTargetUrlCodingStrategy

java.lang.Object
  extended by org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy
All Implemented Interfaces:
IMountableRequestTargetUrlCodingStrategy, IRequestTargetUrlCodingStrategy
Direct Known Subclasses:
BookmarkablePageRequestTargetUrlCodingStrategy, HybridUrlCodingStrategy, IndexedSharedResourceCodingStrategy, PackageRequestTargetUrlCodingStrategy, SharedResourceRequestTargetUrlCodingStrategy, URIRequestTargetUrlCodingStrategy

public abstract class AbstractRequestTargetUrlCodingStrategy
extends Object
implements IRequestTargetUrlCodingStrategy, IMountableRequestTargetUrlCodingStrategy

Abstract class for mount encoders that uses paths and forward slashes.

Author:
Eelco Hillenius, Igor Vaynberg (ivaynberg)

Constructor Summary
AbstractRequestTargetUrlCodingStrategy(String mountPath)
          Construct.
 
Method Summary
protected  void appendParameters(AppendingStringBuffer url, Map<String,?> parameters)
          Encodes Map into a url fragment and append that to the provided url buffer.
protected  void appendPathParameter(AppendingStringBuffer url, String key, String value)
          Appends path parameter
protected  ValueMap decodeParameters(String urlFragment, Map<String,?> urlParameters)
          Decodes parameters object from the provided url fragment
 String getMountPath()
          Returns the path of the url where this request target is mounted on.
 boolean matches(String path, boolean caseSensitive)
          Does given path match this mount? We match /mount/point or /mount/point/with/extra/path, but not /mount/pointXXX.
protected  String urlDecode(String value)
          Deprecated. Use urlEncodePathComponent or urlEncodeQueryComponent instead
protected  String urlDecodePathComponent(String value)
          Returns a decoded value of the given value (taken from a URL path section)
protected  String urlDecodeQueryComponent(String value)
          Returns a decoded value of the given value (taken from a URL query string)
protected  String urlEncode(String string)
          Deprecated. Use urlEncodePathComponent or urlEncodeQueryComponent instead
protected  String urlEncodePathComponent(String string)
          Url encodes a string that is mean for a URL path (e.g., between slashes)
protected  String urlEncodeQueryComponent(String string)
          Url encodes a string mean for a URL query string
 
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.target.coding.IRequestTargetUrlCodingStrategy
decode, encode, matches
 

Constructor Detail

AbstractRequestTargetUrlCodingStrategy

public AbstractRequestTargetUrlCodingStrategy(String mountPath)
Construct.

Parameters:
mountPath - the mount path
Method Detail

getMountPath

public String getMountPath()
Description copied from interface: IRequestTargetUrlCodingStrategy
Returns the path of the url where this request target is mounted on. This should not have a leading slash.

Specified by:
getMountPath in interface IMountableRequestTargetUrlCodingStrategy
Specified by:
getMountPath in interface IRequestTargetUrlCodingStrategy
Returns:
String The path of the url
See Also:
IMountableRequestTargetUrlCodingStrategy.getMountPath()

appendParameters

protected void appendParameters(AppendingStringBuffer url,
                                Map<String,?> parameters)
Encodes Map into a url fragment and append that to the provided url buffer.

Parameters:
url - url so far
parameters - Map object to be encoded

appendPathParameter

protected void appendPathParameter(AppendingStringBuffer url,
                                   String key,
                                   String value)
Appends path parameter

Parameters:
url -
key -
value -

decodeParameters

protected ValueMap decodeParameters(String urlFragment,
                                    Map<String,?> urlParameters)
Decodes parameters object from the provided url fragment

Parameters:
urlFragment - fragment of the url after the decoded path and before the query string
urlParameters - query string parameters
Returns:
Parameters created from the url fragment and query string

urlEncodePathComponent

protected String urlEncodePathComponent(String string)
Url encodes a string that is mean for a URL path (e.g., between slashes)

Parameters:
string - string to be encoded
Returns:
encoded string

urlDecodePathComponent

protected String urlDecodePathComponent(String value)
Returns a decoded value of the given value (taken from a URL path section)

Parameters:
value -
Returns:
Decodes the value

urlEncodeQueryComponent

protected String urlEncodeQueryComponent(String string)
Url encodes a string mean for a URL query string

Parameters:
string - string to be encoded
Returns:
encoded string

urlDecodeQueryComponent

protected String urlDecodeQueryComponent(String value)
Returns a decoded value of the given value (taken from a URL query string)

Parameters:
value -
Returns:
Decodes the value

urlDecode

@Deprecated
protected String urlDecode(String value)
Deprecated. Use urlEncodePathComponent or urlEncodeQueryComponent instead

Parameters:
value -
Returns:
decoded value

urlEncode

@Deprecated
protected String urlEncode(String string)
Deprecated. Use urlEncodePathComponent or urlEncodeQueryComponent instead

Parameters:
string -
Returns:
encoded value

matches

public boolean matches(String path,
                       boolean caseSensitive)
Does given path match this mount? We match /mount/point or /mount/point/with/extra/path, but not /mount/pointXXX.

Specified by:
matches in interface IRequestTargetUrlCodingStrategy
Parameters:
path -
caseSensitive - whether the strategy should treat path argument with case sensitivity or not
Returns:
true if matches, false otherwise


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