public class StandardParameterParser extends Object implements ParameterParser
Constructor and Description |
---|
StandardParameterParser() |
StandardParameterParser(String keyValuePairSeparators,
String keyValueSeparators) |
public StandardParameterParser(String keyValuePairSeparators, String keyValueSeparators) throws PatternSyntaxException
PatternSyntaxException
public StandardParameterParser()
public void init(String config)
init
in interface ParameterParser
public String getConfig()
getConfig
in interface ParameterParser
public Map<String,String> getParams(HttpMessage msg, HtmlParameter.Type type)
getParams
in interface ParameterParser
public List<NameValuePair> getParameters(HttpMessage msg, HtmlParameter.Type type)
ParameterParser
type
from the given message
.
The parameters are split using the key value pair separator(s) and each resulting parameter is split into name/value pairs using key value separator(s).
Parameters' names and values are in decoded form.
getParameters
in interface ParameterParser
msg
- the message whose parameters will be extracted fromtype
- the type of parameters to extractList
containing the parametersIllegalArgumentException
- if any of the parameters is null
or if the given
type
is not url
or
form
.ParameterParser.getDefaultKeyValuePairSeparator()
,
ParameterParser.getDefaultKeyValueSeparator()
public String getKeyValuePairSeparators()
public void setKeyValuePairSeparators(String keyValuePairSeparators) throws PatternSyntaxException
PatternSyntaxException
public String getKeyValueSeparators()
public void setKeyValueSeparators(String keyValueSeparators) throws PatternSyntaxException
PatternSyntaxException
public String getDefaultKeyValuePairSeparator()
getDefaultKeyValuePairSeparator
in interface ParameterParser
public String getDefaultKeyValueSeparator()
getDefaultKeyValueSeparator
in interface ParameterParser
public Map<String,String> parse(String paramStr)
parse
in interface ParameterParser
public List<NameValuePair> parseParameters(String parameters)
ParameterParser
parameters
into a list of NameValuePair
.
The parameters are split using the key value pair separator(s) and each resulting parameter is split into name/value pairs using key value separator(s).
Parameters' names and values are in decoded form.
parseParameters
in interface ParameterParser
parameters
- the String of parameters to parse, might be null
List
containing the parameters parsedParameterParser.getDefaultKeyValuePairSeparator()
,
ParameterParser.getDefaultKeyValueSeparator()
public StandardParameterParser clone()
clone
in interface ParameterParser
clone
in class Object
public List<String> getTreePath(org.apache.commons.httpclient.URI uri) throws org.apache.commons.httpclient.URIException
getTreePath
in interface ParameterParser
org.apache.commons.httpclient.URIException
public List<String> getTreePath(HttpMessage msg) throws org.apache.commons.httpclient.URIException
getTreePath
in interface ParameterParser
org.apache.commons.httpclient.URIException
public String getAncestorPath(org.apache.commons.httpclient.URI uri, int depth) throws org.apache.commons.httpclient.URIException
ParameterParser
A few examples (uri, depth):
page
is a structural parameter
page
and type
are both structural
parameter
getAncestorPath
in interface ParameterParser
uri
- the URIdepth
- the depthorg.apache.commons.httpclient.URIException
- if an error occurred while accessing the provided uripublic void setContext(Context context)
setContext
in interface ParameterParser
public Context getContext()
getContext
in interface ParameterParser