Class URIUtil
java.lang.Object
org.apache.commons.httpclient.util.URIUtil
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classDeprecated.use org.apache.commons.codec.net.URLCodec -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringUnescape and decode a given string regarded as an escaped string with the default protocol charset.static StringUnescape and decode a given string regarded as an escaped string.static StringEscape and encode a given string with allowed characters not to be escaped and the default protocol charset.static StringEscape and encode a given string with allowed characters not to be escaped and a given charset.static StringGet the all escaped and encoded string with the default protocl charset.static StringGet the all escaped and encoded string with a given charset.static StringencodePath(String unescaped) Escape and encode a string regarded as the path component of an URI with the default protocol charset.static StringencodePath(String unescaped, String charset) Escape and encode a string regarded as the path component of an URI with a given charset.static StringencodePathQuery(String unescaped) Escape and encode a string regarded as the path and query components of an URI with the default protocol charset.static StringencodePathQuery(String unescaped, String charset) Escape and encode a string regarded as the path and query components of an URI with a given charset.static StringencodeQuery(String unescaped) Escape and encode a string regarded as the query component of an URI with the default protocol charset.static StringencodeQuery(String unescaped, String charset) Escape and encode a string regarded as the query component of an URI with a given charset.static StringencodeWithinAuthority(String unescaped) Escape and encode a string regarded as within the authority component of an URI with the default protocol charset.static StringencodeWithinAuthority(String unescaped, String charset) Escape and encode a string regarded as within the authority component of an URI with a given charset.static StringencodeWithinPath(String unescaped) Escape and encode a string regarded as within the path component of an URI with the default protocol charset.static StringencodeWithinPath(String unescaped, String charset) Escape and encode a string regarded as within the path component of an URI with a given charset.static StringencodeWithinQuery(String unescaped) Escape and encode a string regarded as within the query component of an URI with the default protocol charset.static StringencodeWithinQuery(String unescaped, String charset) Escape and encode a string regarded as within the query component of an URI with a given charset.static StringgetFromPath(String uri) Get the path of an URI and its rest part.static StringGet the basename of an URI.static StringGet the path of an URI.static StringgetPathQuery(String uri) Get the path and query of an URI.static StringGet the query of an URI.
-
Field Details
-
empty
-
-
Constructor Details
-
URIUtil
public URIUtil()
-
-
Method Details
-
getName
-
getQuery
-
getPath
-
getPathQuery
-
getFromPath
-
encodeAll
Get the all escaped and encoded string with the default protocl charset. It's the same function to useencode(String unescaped, Bitset empty, URI.getDefaultProtocolCharset()).- Parameters:
unescaped- an unescaped string- Returns:
- the escaped string
- Throws:
URIException- if the default protocol charset is not supported- See Also:
-
encodeAll
Get the all escaped and encoded string with a given charset. It's the same function to useencode(String unescaped, Bitset empty, String charset).- Parameters:
unescaped- an unescaped stringcharset- the charset- Returns:
- the escaped string
- Throws:
URIException- if the charset is not supported- See Also:
-
encodeWithinAuthority
Escape and encode a string regarded as within the authority component of an URI with the default protocol charset. Within the authority component, the characters ";", ":", "@", "?", and "/" are reserved.- Parameters:
unescaped- an unescaped string- Returns:
- the escaped string
- Throws:
URIException- if the default protocol charset is not supported- See Also:
-
encodeWithinAuthority
Escape and encode a string regarded as within the authority component of an URI with a given charset. Within the authority component, the characters ";", ":", "@", "?", and "/" are reserved.- Parameters:
unescaped- an unescaped stringcharset- the charset- Returns:
- the escaped string
- Throws:
URIException- if the charset is not supported- See Also:
-
encodePathQuery
Escape and encode a string regarded as the path and query components of an URI with the default protocol charset.- Parameters:
unescaped- an unescaped string- Returns:
- the escaped string
- Throws:
URIException- if the default protocol charset is not supported- See Also:
-
encodePathQuery
Escape and encode a string regarded as the path and query components of an URI with a given charset.- Parameters:
unescaped- an unescaped stringcharset- the charset- Returns:
- the escaped string
- Throws:
URIException- if the charset is not supported- See Also:
-
encodeWithinPath
Escape and encode a string regarded as within the path component of an URI with the default protocol charset. The path may consist of a sequence of path segments separated by a single slash "/" character. Within a path segment, the characters "/", ";", "=", and "?" are reserved.- Parameters:
unescaped- an unescaped string- Returns:
- the escaped string
- Throws:
URIException- if the default protocol charset is not supported- See Also:
-
encodeWithinPath
Escape and encode a string regarded as within the path component of an URI with a given charset. The path may consist of a sequence of path segments separated by a single slash "/" character. Within a path segment, the characters "/", ";", "=", and "?" are reserved.- Parameters:
unescaped- an unescaped stringcharset- the charset- Returns:
- the escaped string
- Throws:
URIException- if the charset is not supported- See Also:
-
encodePath
Escape and encode a string regarded as the path component of an URI with the default protocol charset.- Parameters:
unescaped- an unescaped string- Returns:
- the escaped string
- Throws:
URIException- if the default protocol charset is not supported- See Also:
-
encodePath
Escape and encode a string regarded as the path component of an URI with a given charset.- Parameters:
unescaped- an unescaped stringcharset- the charset- Returns:
- the escaped string
- Throws:
URIException- if the charset is not supported- See Also:
-
encodeWithinQuery
Escape and encode a string regarded as within the query component of an URI with the default protocol charset. When a query comprise the name and value pairs, it is used in order to encode each name and value string. The reserved special characters within a query component are being included in encoding the query.- Parameters:
unescaped- an unescaped string- Returns:
- the escaped string
- Throws:
URIException- if the default protocol charset is not supported- See Also:
-
encodeWithinQuery
Escape and encode a string regarded as within the query component of an URI with a given charset. When a query comprise the name and value pairs, it is used in order to encode each name and value string. The reserved special characters within a query component are being included in encoding the query.- Parameters:
unescaped- an unescaped stringcharset- the charset- Returns:
- the escaped string
- Throws:
URIException- if the charset is not supported- See Also:
-
encodeQuery
Escape and encode a string regarded as the query component of an URI with the default protocol charset. When a query string is not misunderstood the reserved special characters ("&", "=", "+", ",", and "$") within a query component, this method is recommended to use in encoding the whole query.- Parameters:
unescaped- an unescaped string- Returns:
- the escaped string
- Throws:
URIException- if the default protocol charset is not supported- See Also:
-
encodeQuery
Escape and encode a string regarded as the query component of an URI with a given charset. When a query string is not misunderstood the reserved special characters ("&", "=", "+", ",", and "$") within a query component, this method is recommended to use in encoding the whole query.- Parameters:
unescaped- an unescaped stringcharset- the charset- Returns:
- the escaped string
- Throws:
URIException- if the charset is not supported- See Also:
-
encode
Escape and encode a given string with allowed characters not to be escaped and the default protocol charset.- Parameters:
unescaped- a stringallowed- allowed characters not to be escaped- Returns:
- the escaped string
- Throws:
URIException- if the default protocol charset is not supported- See Also:
-
encode
Escape and encode a given string with allowed characters not to be escaped and a given charset.- Parameters:
unescaped- a stringallowed- allowed characters not to be escapedcharset- the charset- Returns:
- the escaped string
- Throws:
URIException
-
decode
Unescape and decode a given string regarded as an escaped string with the default protocol charset.- Parameters:
escaped- a string- Returns:
- the unescaped string
- Throws:
URIException- if the string cannot be decoded (invalid)- See Also:
-
decode
Unescape and decode a given string regarded as an escaped string.- Parameters:
escaped- a stringcharset- the charset- Returns:
- the unescaped string
- Throws:
URIException- if the charset is not supported- See Also:
-