org.apache.wicket.request.target.coding
Class MixedParamUrlCodingStrategy
java.lang.Object
org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy
org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy
org.apache.wicket.request.target.coding.MixedParamUrlCodingStrategy
- All Implemented Interfaces:
- IMountableRequestTargetUrlCodingStrategy, IRequestTargetUrlCodingStrategy
public class MixedParamUrlCodingStrategy
- extends BookmarkablePageRequestTargetUrlCodingStrategy
Url coding strategy for bookmarkable pages that encodes a set of given parameters in the url's
path and the rest in the query-string.
Strategy looks for path-parameters whose name is read from an array of names e.g. ["param0",
"param1"]. Found parameters will be appended to the url in the form
/mount-path/paramvalue0/paramvalue1
.
All other parameters are added as parameter in the form:
/mount-path/paramvalue0?otherparam0=otherparamvalue0&otherparam1=otherparamvalue1
.
Decode is symmetric except for when a path parameter that is not at the end has no value during
encode. For example, the names for the path parameters are: "a", "b" and "c". When "b" is not
specified upon encoding, but "c" is, upon a decode "b" will get the empty string as value. When
both "b" and "c" are missing on encode, the will not get a value during decode.
- Author:
- erik.van.oosten
MixedParamUrlCodingStrategy
public MixedParamUrlCodingStrategy(String mountPath,
Class<C> bookmarkablePageClass,
String pageMapName,
String[] parameterNames)
- Construct.
- Type Parameters:
C
- - Parameters:
mountPath
- mount pathbookmarkablePageClass
- class of mounted pagepageMapName
- name of pagemapparameterNames
- the parameter names (not null)
MixedParamUrlCodingStrategy
public MixedParamUrlCodingStrategy(String mountPath,
Class<C> bookmarkablePageClass,
String[] parameterNames)
- Construct.
- Type Parameters:
C
- - Parameters:
mountPath
- mount path (not empty)bookmarkablePageClass
- class of mounted page (not null)parameterNames
- the parameter names (not null)
setIgnoreUndeclaredParameters
public MixedParamUrlCodingStrategy setIgnoreUndeclaredParameters(boolean ignoreUndeclaredParameters)
- Parameters:
ignoreUndeclaredParameters
- true to ignore undeclared parameters in the URL (still logged), false to throw an
exception when this happens (default is true)
- Returns:
- this
appendParameters
protected void appendParameters(AppendingStringBuffer url,
Map<String,?> parameters)
- Description copied from class:
AbstractRequestTargetUrlCodingStrategy
- Encodes Map into a url fragment and append that to the provided url buffer.
- Overrides:
appendParameters
in class AbstractRequestTargetUrlCodingStrategy
- Parameters:
url
- url so farparameters
- Map object to be encoded- See Also:
AbstractRequestTargetUrlCodingStrategy.appendParameters(org.apache.wicket.util.string.AppendingStringBuffer,
java.util.Map)
decodeParameters
protected ValueMap decodeParameters(String urlFragment,
Map<String,?> urlParameters)
- Description copied from class:
AbstractRequestTargetUrlCodingStrategy
- Decodes parameters object from the provided url fragment
- Overrides:
decodeParameters
in class AbstractRequestTargetUrlCodingStrategy
- Parameters:
urlFragment
- fragment of the url after the decoded path and before the query stringurlParameters
- query string parameters
- Returns:
- Parameters created from the url fragment and query string
- See Also:
AbstractRequestTargetUrlCodingStrategy.decodeParameters(java.lang.String,
java.util.Map)
Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.