Interface ParameterParser
-
- All Known Implementing Classes:
StandardParameterParser
public interface ParameterParser
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description ParameterParser
clone()
java.lang.String
getAncestorPath(org.apache.commons.httpclient.URI uri, int depth)
Gets the path of the URI's ancestor found at the given depth, taking into account any context specific configuration (e.g.java.lang.String
getConfig()
Context
getContext()
java.lang.String
getDefaultKeyValuePairSeparator()
java.lang.String
getDefaultKeyValueSeparator()
java.util.List<NameValuePair>
getParameters(HttpMessage msg, HtmlParameter.Type type)
Gets the parameters of the giventype
from the givenmessage
.java.util.Map<java.lang.String,java.lang.String>
getParams(HttpMessage msg, HtmlParameter.Type type)
Deprecated.2.10.0 use #getParameters(String) This method will lose duplicated parameter namesjava.util.List<java.lang.String>
getTreePath(org.apache.commons.httpclient.URI uri)
java.util.List<java.lang.String>
getTreePath(HttpMessage msg)
void
init(java.lang.String config)
java.util.Map<java.lang.String,java.lang.String>
parse(java.lang.String paramStr)
Deprecated.2.10.0 use #parseParameters(String) This method will lose duplicated parameter namesjava.util.List<NameValuePair>
parseParameters(java.lang.String parameters)
Parses the givenparameters
into a list ofNameValuePair
.default java.util.List<NameValuePair>
parseRawParameters(java.lang.String parameters)
Parses the givenparameters
into a list ofNameValuePair
.void
setContext(Context context)
-
-
-
Method Detail
-
init
void init(java.lang.String config)
-
getParams
@Deprecated java.util.Map<java.lang.String,java.lang.String> getParams(HttpMessage msg, HtmlParameter.Type type)
Deprecated.2.10.0 use #getParameters(String) This method will lose duplicated parameter names
-
getParameters
java.util.List<NameValuePair> getParameters(HttpMessage msg, HtmlParameter.Type type)
Gets the parameters of the giventype
from the givenmessage
.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, if not malformed, otherwise the original name/value. Names and values are never
null
.- Parameters:
msg
- the message whose parameters will be extracted fromtype
- the type of parameters to extract- Returns:
- a
List
containing the parameters - Throws:
java.lang.IllegalArgumentException
- if themsg
ortype
isnull
.- Since:
- 2.5.0
- See Also:
getDefaultKeyValuePairSeparator()
,getDefaultKeyValueSeparator()
-
parse
@Deprecated java.util.Map<java.lang.String,java.lang.String> parse(java.lang.String paramStr)
Deprecated.2.10.0 use #parseParameters(String) This method will lose duplicated parameter names
-
parseParameters
java.util.List<NameValuePair> parseParameters(java.lang.String parameters)
Parses the givenparameters
into a list ofNameValuePair
.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, if not malformed, otherwise the original name/value. Names and values are never
null
.- Parameters:
parameters
- the String of parameters to parse, might benull
- Returns:
- a
List
containing the parameters parsed - Since:
- 2.5.0
- See Also:
getDefaultKeyValuePairSeparator()
,getDefaultKeyValueSeparator()
-
parseRawParameters
default java.util.List<NameValuePair> parseRawParameters(java.lang.String parameters)
Parses the givenparameters
into a list ofNameValuePair
.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).
Unlike
parseParameters(String)
the parameters' names and values are not decoded. This allows to rebuild the original string without (re)encoding issues. Values might benull
, when not present.By default returns an empty list.
- Parameters:
parameters
- the String of parameters to parse, might benull
.- Returns:
- a
List
containing the parameters parsed, nevernull
. - Since:
- 2.10.0
- See Also:
getDefaultKeyValuePairSeparator()
,getDefaultKeyValueSeparator()
-
getTreePath
java.util.List<java.lang.String> getTreePath(org.apache.commons.httpclient.URI uri) throws org.apache.commons.httpclient.URIException
- Throws:
org.apache.commons.httpclient.URIException
-
getTreePath
java.util.List<java.lang.String> getTreePath(HttpMessage msg) throws org.apache.commons.httpclient.URIException
- Throws:
org.apache.commons.httpclient.URIException
-
getAncestorPath
java.lang.String getAncestorPath(org.apache.commons.httpclient.URI uri, int depth) throws org.apache.commons.httpclient.URIException
Gets the path of the URI's ancestor found at the given depth, taking into account any context specific configuration (e.g. structural parameters). The depth could also be seen as the number of path elements returned.A few examples (uri, depth):
- (http://example.org/path/to/element, 0) -> ""
- (http://example.org/path/to/element, 1) -> "/path"
- (http://example.org/path/to/element, 3) -> "/path/to/element"
- (http://example.org/path?page=12&data=123, 2) -> "/path?page=12", if
page
is a structural parameter - (http://example.org/path?page=12&data=123&type=1, 3) ->
"/path?page=12&type=1", if
page
andtype
are both structural parameter
- Parameters:
uri
- the URIdepth
- the depth- Returns:
- the path of the ancestor
- Throws:
org.apache.commons.httpclient.URIException
- if an error occurred while accessing the provided uri
-
getDefaultKeyValuePairSeparator
java.lang.String getDefaultKeyValuePairSeparator()
-
getDefaultKeyValueSeparator
java.lang.String getDefaultKeyValueSeparator()
-
getConfig
java.lang.String getConfig()
-
clone
ParameterParser clone()
-
setContext
void setContext(Context context)
-
getContext
Context getContext()
-
-