|
||||||||||
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 BitSet |
empty
|
Constructor Summary | |
URIUtil()
|
Method Summary | |
static String |
decode(String escaped)
Unescape and decode a given string regarded as an escaped string with the default protocol charset. |
static String |
decode(String escaped,
String charset)
Unescape and decode a given string regarded as an escaped string. |
static String |
encode(String unescaped,
BitSet allowed)
Escape and encode a given string with allowed characters not to be escaped and the default protocol charset. |
static String |
encode(String unescaped,
BitSet allowed,
String charset)
Escape and encode a given string with allowed characters not to be escaped and a given charset. |
static String |
encodeAll(String unescaped)
Get the all escaped and encoded string with the default protocl charset. |
static String |
encodeAll(String unescaped,
String charset)
Get the all escaped and encoded string with a given charset. |
static String |
encodePath(String unescaped)
Escape and encode a string regarded as the path component of an URI with the default protocol charset. |
static String |
encodePath(String unescaped,
String charset)
Escape and encode a string regarded as the path component of an URI with a given charset. |
static String |
encodePathQuery(String unescaped)
Escape and encode a string regarded as the path and query components of an URI with the default protocol charset. |
static String |
encodePathQuery(String unescaped,
String charset)
Escape and encode a string regarded as the path and query components of an URI with a given charset. |
static String |
encodeQuery(String unescaped)
Escape and encode a string regarded as the query component of an URI with the default protocol charset. |
static String |
encodeQuery(String unescaped,
String charset)
Escape and encode a string regarded as the query component of an URI with a given charset. |
static String |
encodeWithinAuthority(String unescaped)
Escape and encode a string regarded as within the authority component of an URI with the default protocol charset. |
static String |
encodeWithinAuthority(String unescaped,
String charset)
Escape and encode a string regarded as within the authority component of an URI with a given charset. |
static String |
encodeWithinPath(String unescaped)
Escape and encode a string regarded as within the path component of an URI with the default protocol charset. |
static String |
encodeWithinPath(String unescaped,
String charset)
Escape and encode a string regarded as within the path component of an URI with a given charset. |
static String |
encodeWithinQuery(String unescaped)
Escape and encode a string regarded as within the query component of an URI with the default protocol charset. |
static String |
encodeWithinQuery(String unescaped,
String charset)
Escape and encode a string regarded as within the query component of an URI with a given charset. |
static String |
getFromPath(String uri)
Get the path of an URI and its rest part. |
static String |
getName(String uri)
Get the basename of an URI. |
static String |
getPath(String uri)
Get the path of an URI. |
static String |
getPathQuery(String uri)
Get the path and query of an URI. |
static String |
getQuery(String uri)
Get the query of an URI. |
static String |
toDocumentCharset(String target)
Deprecated. Do not use. To be removed |
static String |
toDocumentCharset(String target,
String charset)
Deprecated. Do not use. To be removed |
static String |
toProtocolCharset(String target)
Deprecated. Do not use. To be removed |
static String |
toProtocolCharset(String target,
String charset)
Deprecated. Do not use. To be removed |
static String |
toUsingCharset(String target,
String fromCharset,
String toCharset)
Deprecated. Do not use. To be removed |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected static final BitSet empty
Constructor Detail |
public URIUtil()
Method Detail |
public static String getName(String uri)
uri
- a string regarded an URIpublic static String getQuery(String uri)
uri
- a string regarded an URInull
if empty or undefinedpublic static String getPath(String uri)
uri
- a string regarded an URIpublic static String getPathQuery(String uri)
uri
- a string regarded an URIpublic static String getFromPath(String uri)
uri
- a string regarded an URIpublic static String encodeAll(String unescaped) throws URIException
encode(String unescaped, Bitset
empty, URI.getDefaultProtocolCharset())
.unescaped
- an unescaped stringURIException
- if the default protocol charset is not supportedURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static String encodeAll(String unescaped, String charset) throws URIException
encode(String unescaped, Bitset
empty, String charset)
.unescaped
- an unescaped stringcharset
- the charsetURIException
- if the charset is not supportedencode(java.lang.String, java.util.BitSet)
public static String encodeWithinAuthority(String unescaped) throws URIException
unescaped
- an unescaped stringURIException
- if the default protocol charset is not supportedURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static String encodeWithinAuthority(String unescaped, String charset) throws URIException
unescaped
- an unescaped stringcharset
- the charsetURIException
- if the charset is not supportedencode(java.lang.String, java.util.BitSet)
public static String encodePathQuery(String unescaped) throws URIException
unescaped
- an unescaped stringURIException
- if the default protocol charset is not supportedURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static String encodePathQuery(String unescaped, String charset) throws URIException
unescaped
- an unescaped stringcharset
- the charsetURIException
- if the charset is not supportedencode(java.lang.String, java.util.BitSet)
public static String encodeWithinPath(String unescaped) throws URIException
unescaped
- an unescaped stringURIException
- if the default protocol charset is not supportedURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static String encodeWithinPath(String unescaped, String charset) throws URIException
unescaped
- an unescaped stringcharset
- the charsetURIException
- if the charset is not supportedencode(java.lang.String, java.util.BitSet)
public static String encodePath(String unescaped) throws URIException
unescaped
- an unescaped stringURIException
- if the default protocol charset is not supportedURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static String encodePath(String unescaped, String charset) throws URIException
unescaped
- an unescaped stringcharset
- the charsetURIException
- if the charset is not supportedencode(java.lang.String, java.util.BitSet)
public static String encodeWithinQuery(String unescaped) throws URIException
unescaped
- an unescaped stringURIException
- if the default protocol charset is not supportedURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static String encodeWithinQuery(String unescaped, String charset) throws URIException
unescaped
- an unescaped stringcharset
- the charsetURIException
- if the charset is not supportedencode(java.lang.String, java.util.BitSet)
public static String encodeQuery(String unescaped) throws URIException
unescaped
- an unescaped stringURIException
- if the default protocol charset is not supportedURI.getDefaultProtocolCharset()
,
encode(java.lang.String, java.util.BitSet)
public static String encodeQuery(String unescaped, String charset) throws URIException
unescaped
- an unescaped stringcharset
- the charsetURIException
- if the charset is not supportedencode(java.lang.String, java.util.BitSet)
public static String encode(String unescaped, BitSet allowed) throws URIException
unescaped
- a stringallowed
- allowed characters not to be escapedURIException
- if the default protocol charset is not supportedURI.getDefaultProtocolCharset()
,
URIUtil.Coder.encode(java.lang.String, java.util.BitSet, java.lang.String)
public static String encode(String unescaped, BitSet allowed, String charset) throws URIException
unescaped
- a stringallowed
- allowed characters not to be escapedcharset
- the charsetURIException
- if the charset is not supportedURIUtil.Coder.encode(java.lang.String, java.util.BitSet, java.lang.String)
public static String decode(String escaped) throws URIException
escaped
- a stringURIException
- if the default protocol charset is not supportedURI.getDefaultProtocolCharset()
,
URIUtil.Coder.decode(char[], java.lang.String)
public static String decode(String escaped, String charset) throws URIException
escaped
- a stringcharset
- the charsetURIException
- if the charset is not supportedURIUtil.Coder.decode(char[], java.lang.String)
public static String toProtocolCharset(String target) throws URIException
target
- a target stringURIException
- if the default protocol charset is not supportedURI.getDefaultProtocolCharset()
public static String toProtocolCharset(String target, String charset) throws URIException
target
- a target stringcharset
- the transformed protocol charsetURIException
- if the charset is not supportedpublic static String toDocumentCharset(String target) throws URIException
target
- a target stringURIException
- if the default protocol charset is not supportedURI.getDefaultDocumentCharset()
public static String toDocumentCharset(String target, String charset) throws URIException
target
- a target stringcharset
- the transformed document charsetURIException
- if the charset is not supportedpublic static String toUsingCharset(String target, String fromCharset, 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 charsetURIException
- if either of the charsets are not supported
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |