|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mortbay.util.URI
URI Holder. This class assists with the decoding and encoding or HTTP URI's. It differs from the java.net.URL class as it does not provide communications ability, but it does assist with query string formatting.
ISO_8859_1 encoding is used by default for % encoded characters. This may be overridden with the org.mortbay.util.URI.charset system property.
UrlEncoded
Field Summary | |
static java.lang.String |
__CHARSET
|
Constructor Summary | |
URI(java.lang.String uri)
Construct from a String. |
|
URI(URI uri)
Copy Constructor . |
Method Summary | |
static java.lang.String |
addPaths(java.lang.String p1,
java.lang.String p2)
Add two URI path segments. |
static java.lang.String |
canonicalPath(java.lang.String path)
Convert a path to a cananonical form. |
void |
clearParameters()
Clear the URI _parameters. |
java.lang.Object |
clone()
Clone URI. |
static java.lang.String |
decodePath(java.lang.String path)
|
static java.lang.String |
encodePath(java.lang.String path)
Encode a URI path. |
static java.lang.StringBuffer |
encodePath(java.lang.StringBuffer buf,
java.lang.String path)
Encode a URI path. |
static java.lang.StringBuffer |
encodeString(java.lang.StringBuffer buf,
java.lang.String path,
java.lang.String encode)
Encode a URI path. |
java.lang.String |
get(java.lang.String name)
Get named value |
java.lang.String |
getEncodedPath()
Get the encoded uri path. |
java.lang.String |
getHost()
Get the uri host. |
java.util.Set |
getParameterNames()
Get the uri query _parameters names. |
MultiMap |
getParameters()
Get the uri query _parameters. |
java.lang.String |
getPath()
Get the uri path. |
int |
getPort()
Get the uri port. |
java.lang.String |
getQuery()
Get the uri query String. |
java.lang.String |
getScheme()
Get the uri scheme. |
java.util.Map |
getUnmodifiableParameters()
Get the uri query _parameters. |
java.util.List |
getValues(java.lang.String name)
Get named multiple values. |
static boolean |
hasScheme(java.lang.String uri)
|
boolean |
isAbsolute()
Is the URI an absolute URL? |
static java.lang.String |
parentPath(java.lang.String p)
Return the parent Path. |
void |
put(java.util.Map values)
Add dictionary to the uri query _parameters. |
java.lang.Object |
put(java.lang.Object name,
java.lang.Object value)
Add name value pair to the uri query _parameters. |
void |
put(java.lang.String encoded)
Add encoded _parameters. |
void |
putParametersTo(MultiMap map)
Add the uri query _parameters to a MultiMap |
void |
remove(java.lang.String name)
Remove named value |
void |
setHost(java.lang.String host)
Set the uri host. |
void |
setPath(java.lang.String path)
Set the uri path. |
void |
setPort(int port)
Set the uri port. |
void |
setQuery(java.lang.String query)
Set the uri query String. |
void |
setScheme(java.lang.String scheme)
Set the uri scheme. |
void |
setURI(java.lang.String uri)
|
static java.lang.String |
stripPath(java.lang.String path)
Strip parameters from a path. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String __CHARSET
Constructor Detail |
public URI(URI uri) throws java.lang.IllegalArgumentException
uri
- public URI(java.lang.String uri) throws java.lang.IllegalArgumentException
uri
- [scheme://host[:port]]/path[?query]Method Detail |
public void setURI(java.lang.String uri) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public boolean isAbsolute()
public java.lang.String getScheme()
public void setScheme(java.lang.String scheme)
scheme
- the uri schemepublic java.lang.String getHost()
public void setHost(java.lang.String host)
host
- the uri hostpublic int getPort()
public void setPort(int port)
port
- the uri portpublic java.lang.String getPath()
public java.lang.String getEncodedPath()
public void setPath(java.lang.String path)
path
- the URI pathpublic java.lang.String getQuery()
public void setQuery(java.lang.String query)
query
- the URI query stringpublic java.util.Set getParameterNames()
public MultiMap getParameters()
public java.util.Map getUnmodifiableParameters()
public void putParametersTo(MultiMap map)
public void clearParameters()
public void put(java.lang.String encoded)
encoded
- A HTTP encoded string of _parameters: e.g.. "a=1&b=2"public java.lang.Object put(java.lang.Object name, java.lang.Object value)
name
- name of valuevalue
- The value, which may be a multi valued list or
String array.public void put(java.util.Map values)
public java.lang.String get(java.lang.String name)
public java.util.List getValues(java.lang.String name)
name
- The parameter name
public void remove(java.lang.String name)
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String encodePath(java.lang.String path)
path
- The path the encode
public static java.lang.StringBuffer encodePath(java.lang.StringBuffer buf, java.lang.String path)
path
- The path the encodebuf
- StringBuffer to encode path into (or null)
public static java.lang.StringBuffer encodeString(java.lang.StringBuffer buf, java.lang.String path, java.lang.String encode)
path
- The path the encodebuf
- StringBuffer to encode path into (or null)encode
- String of characters to encode. % is always encoded.
public static java.lang.String decodePath(java.lang.String path)
public java.lang.Object clone()
clone
in class java.lang.Object
public static java.lang.String addPaths(java.lang.String p1, java.lang.String p2)
p1
- URI path segmentp2
- URI path segment
public static java.lang.String parentPath(java.lang.String p)
public static java.lang.String stripPath(java.lang.String path)
public static java.lang.String canonicalPath(java.lang.String path)
path
-
public static boolean hasScheme(java.lang.String uri)
uri
- URI
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |