|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.httpclient.util.URIUtil
The URI escape and character encoding and decoding utility.
It's compatible with HttpURL
rather
than URI
.
Inner Class Summary | |
protected static class |
URIUtil.Coder
The basic and internal utility for URI escape and character encoding and decoding. |
Field Summary | |
protected static java.util.BitSet |
empty
|
Constructor Summary | |
URIUtil()
|
Method Summary | |
static java.lang.String |
decode(java.lang.String escaped)
Unescape and decode a given string regarded as an escaped string with the default protocol charset. |
static java.lang.String |
decode(java.lang.String escaped,
java.lang.String charset)
Unescape and decode a given string regarded as an escaped string. |
static java.lang.String |
encode(java.lang.String unescaped,
java.util.BitSet allowed)
Escape and encode a given string with allowed characters not to be escaped and the default protocol charset. |
static java.lang.String |
encode(java.lang.String unescaped,
java.util.BitSet allowed,
java.lang.String charset)
Escape and encode a given string with allowed characters not to be escaped and a given charset. |
static java.lang.String |
encodeAll(java.lang.String unescaped)
Get the all escaped and encoded string with the default protocl charset. |
static java.lang.String |
encodeAll(java.lang.String unescaped,
java.lang.String charset)
Get the all escaped and encoded string with a given charset. |
static java.lang.String |
encodePath(java.lang.String unescaped)
Escape and encode a string regarded as the path component of an URI with the default protocol charset. |
static java.lang.String |
encodePath(java.lang.String unescaped,
java.lang.String charset)
Escape and encode a string regarded as the path component of an URI with a given charset. |
static java.lang.String |
encodePathQuery(java.lang.String unescaped)
Escape and encode a string regarded as the path and query components of an URI with the default protocol charset. |
static java.lang.String |
encodePathQuery(java.lang.String unescaped,
java.lang.String charset)
Escape and encode a string regarded as the path and query components of an URI with a given charset. |
static java.lang.String |
encodeQuery(java.lang.String unescaped)
Escape and encode a string regarded as the query component of an URI with the default protocol charset. |
static java.lang.String |
encodeQuery(java.lang.String unescaped,
java.lang.String charset)
Escape and encode a string regarded as the query component of an URI with a given charset. |
static java.lang.String |
encodeWithinAuthority(java.lang.String unescaped)
Escape and encode a string regarded as within the authority component of an URI with the default protocol charset. |
static java.lang.String |
encodeWithinAuthority(java.lang.String unescaped,
java.lang.String charset)
Escape and encode a string regarded as within the authority component of an URI with a given charset. |
static java.lang.String |
encodeWithinPath(java.lang.String unescaped)
Escape and encode a string regarded as within the path component of an URI with the default protocol charset. |
static java.lang.String |
encodeWithinPath(java.lang.String unescaped,
java.lang.String charset)
Escape and encode a string regarded as within the path component of an URI with a given charset. |
static java.lang.String |
encodeWithinQuery(java.lang.String unescaped)
Escape and encode a string regarded as within the query component of an URI with the default protocol charset. |
static java.lang.String |
encodeWithinQuery(java.lang.String unescaped,
java.lang.String charset)
Escape and encode a string regarded as within the query component of an URI with a given charset. |
static java.lang.String |
getFromPath(java.lang.String uri)
Get the path of an URI and its rest part. |
static java.lang.String |
getName(java.lang.String uri)
Get the basename of an URI. |
static java.lang.String |
getPath(java.lang.String uri)
Get the path of an URI. |
static java.lang.String |
getPathQuery(java.lang.String uri)
Get the path and query of an URI. |
static java.lang.String |
getQuery(java.lang.String uri)
Get the query of an URI. |
static java.lang.String |
toDocumentCharset(java.lang.String target)
Deprecated. Do not use. To be removed |
static java.lang.String |
toDocumentCharset(java.lang.String target,
java.lang.String charset)
Deprecated. Do not use. To be removed |
static java.lang.String |
toProtocolCharset(java.lang.String target)
Deprecated. Do not use. To be removed |
static java.lang.String |
toProtocolCharset(java.lang.String target,
java.lang.String charset)
Deprecated. Do not use. To be removed |
static java.lang.String |
toUsingCharset(java.lang.String target,
java.lang.String fromCharset,
java.lang.String toCharset)
Deprecated. Do not use. To be removed |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected static final java.util.BitSet empty
Constructor Detail |
public URIUtil()
Method Detail |
public static java.lang.String getName(java.lang.String uri)
uri
- a string regarded an URIpublic static java.lang.String getQuery(java.lang.String uri)
uri
- a string regarded an URInull
if empty or undefinedpublic static java.lang.String getPath(java.lang.String uri)
uri
- a string regarded an URIpublic static java.lang.String getPathQuery(java.lang.String uri)
uri
- a string regarded an URIpublic static java.lang.String getFromPath(java.lang.String uri)
uri
- a string regarded an URIpublic static java.lang.String encodeAll(java.lang.String unescaped) throws URIException
encode(String unescaped, Bitset
empty, URI.getDefaultProtocolCharset())
.unescaped
- an unescaped stringURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static java.lang.String encodeAll(java.lang.String unescaped, java.lang.String charset) throws URIException
encode(String unescaped, Bitset
empty, String charset)
.unescaped
- an unescaped stringcharset
- the charsetencode(java.lang.String, java.util.BitSet)
public static java.lang.String encodeWithinAuthority(java.lang.String unescaped) throws URIException
unescaped
- an unescaped stringURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static java.lang.String encodeWithinAuthority(java.lang.String unescaped, java.lang.String charset) throws URIException
unescaped
- an unescaped stringcharset
- the charsetencode(java.lang.String, java.util.BitSet)
public static java.lang.String encodePathQuery(java.lang.String unescaped) throws URIException
unescaped
- an unescaped stringURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static java.lang.String encodePathQuery(java.lang.String unescaped, java.lang.String charset) throws URIException
unescaped
- an unescaped stringcharset
- the charsetencode(java.lang.String, java.util.BitSet)
public static java.lang.String encodeWithinPath(java.lang.String unescaped) throws URIException
unescaped
- an unescaped stringURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static java.lang.String encodeWithinPath(java.lang.String unescaped, java.lang.String charset) throws URIException
unescaped
- an unescaped stringcharset
- the charsetencode(java.lang.String, java.util.BitSet)
public static java.lang.String encodePath(java.lang.String unescaped) throws URIException
unescaped
- an unescaped stringURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static java.lang.String encodePath(java.lang.String unescaped, java.lang.String charset) throws URIException
unescaped
- an unescaped stringcharset
- the charsetencode(java.lang.String, java.util.BitSet)
public static java.lang.String encodeWithinQuery(java.lang.String unescaped) throws URIException
unescaped
- an unescaped stringURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static java.lang.String encodeWithinQuery(java.lang.String unescaped, java.lang.String charset) throws URIException
unescaped
- an unescaped stringcharset
- the charsetencode(java.lang.String, java.util.BitSet)
public static java.lang.String encodeQuery(java.lang.String unescaped) throws URIException
unescaped
- an unescaped stringURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static java.lang.String encodeQuery(java.lang.String unescaped, java.lang.String charset) throws URIException
unescaped
- an unescaped stringcharset
- the charsetencode(java.lang.String, java.util.BitSet)
public static java.lang.String encode(java.lang.String unescaped, java.util.BitSet allowed) throws URIException
unescaped
- a stringallowed
- allowed characters not to be escapedURI.getDefaultProtocolCharset()
,
URIUtil.Coder.encode(java.lang.String, java.util.BitSet, java.lang.String)
public static java.lang.String encode(java.lang.String unescaped, java.util.BitSet allowed, java.lang.String charset) throws URIException
unescaped
- a stringallowed
- allowed characters not to be escapedcharset
- the charsetURIUtil.Coder.encode(java.lang.String, java.util.BitSet, java.lang.String)
public static java.lang.String decode(java.lang.String escaped) throws URIException
escaped
- a stringURI.getDefaultProtocolCharset()
,
URIUtil.Coder.decode(char[], java.lang.String)
public static java.lang.String decode(java.lang.String escaped, java.lang.String charset) throws URIException
escaped
- a stringcharset
- the charsetURIUtil.Coder.decode(char[], java.lang.String)
public static java.lang.String toProtocolCharset(java.lang.String target) throws URIException
target
- a target stringURI.getDefaultProtocolCharset()
public static java.lang.String toProtocolCharset(java.lang.String target, java.lang.String charset) throws URIException
target
- a target stringcharset
- the transformed protocol charsetpublic static java.lang.String toDocumentCharset(java.lang.String target) throws URIException
target
- a target stringURI.getDefaultDocumentCharset()
public static java.lang.String toDocumentCharset(java.lang.String target, java.lang.String charset) throws URIException
target
- a target stringcharset
- the transformed document charsetpublic static java.lang.String toUsingCharset(java.lang.String target, java.lang.String fromCharset, java.lang.String toCharset) throws URIException
fromCharset
charset to
the toCharset
charset.
What if the document charset is ISO-8859-1 and the protocol charset is
UTF-8, when it's read from the document part and is used in the protocol
part, the use of the method will be toUsingCharset(the string,
"ISO-8859-1", "UTF-8")
.
target
- a target stringfromCharset
- the previous charsettoCharset
- the changing charset
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |