Interface ParameterParser

    • 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 given 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, if not malformed, otherwise the original name/value. Names and values are never null.

        Parameters:
        msg - the message whose parameters will be extracted from
        type - the type of parameters to extract
        Returns:
        a List containing the parameters
        Throws:
        java.lang.IllegalArgumentException - if the msg or type is null.
        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 given 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, if not malformed, otherwise the original name/value. Names and values are never null.

        Parameters:
        parameters - the String of parameters to parse, might be null
        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 given 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).

        Unlike parseParameters(String) the parameters' names and values are not decoded. This allows to rebuild the original string without (re)encoding issues. Values might be null, when not present.

        By default returns an empty list.

        Parameters:
        parameters - the String of parameters to parse, might be null.
        Returns:
        a List containing the parameters parsed, never null.
        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 and type are both structural parameter
        Parameters:
        uri - the URI
        depth - 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()
      • setContext

        void setContext​(Context context)