public class URI extends Object implements Cloneable
ISO_8859_1 encoding is used by default for % encoded characters. This may be overridden with the org.openqa.jetty.util.URI.charset system property.
UrlEncoded
Modifier and Type | Field and Description |
---|---|
static String |
__CHARSET |
static boolean |
__CHARSET_IS_DEFAULT |
Constructor and Description |
---|
URI(String uri)
Construct from a String.
|
URI(URI uri)
Copy Constructor .
|
Modifier and Type | Method and Description |
---|---|
static String |
addPaths(String p1,
String p2)
Add two URI path segments.
|
static String |
canonicalPath(String path)
Convert a path to a cananonical form.
|
void |
clearParameters()
Clear the URI _parameters.
|
Object |
clone()
Clone URI.
|
static String |
decodePath(String path) |
static String |
encodePath(String path)
Encode a URI path.
|
static StringBuffer |
encodePath(StringBuffer buf,
String path)
Encode a URI path.
|
static StringBuffer |
encodeString(StringBuffer buf,
String path,
String encode)
Encode a URI path.
|
String |
get(String name)
Get named value
|
String |
getEncodedPath()
Get the encoded uri path.
|
String |
getHost()
Get the uri host.
|
Set |
getParameterNames()
Get the uri query _parameters names.
|
MultiMap |
getParameters()
Get the uri query _parameters.
|
String |
getPath()
Get the uri path.
|
int |
getPort()
Get the uri port.
|
String |
getQuery()
Get the uri query String.
|
String |
getScheme()
Get the uri scheme.
|
Map |
getUnmodifiableParameters()
Get the uri query _parameters.
|
List |
getValues(String name)
Get named multiple values.
|
static boolean |
hasScheme(String uri) |
boolean |
isAbsolute()
Is the URI an absolute URL?
|
static String |
parentPath(String p)
Return the parent Path.
|
void |
put(Map values)
Add dictionary to the uri query _parameters.
|
Object |
put(Object name,
Object value)
Add name value pair to the uri query _parameters.
|
void |
put(String encoded)
Add encoded _parameters.
|
void |
putParametersTo(MultiMap map)
Add the uri query _parameters to a MultiMap
|
void |
remove(String name)
Remove named value
|
void |
setHost(String host)
Set the uri host.
|
void |
setPath(String path)
Set the uri path.
|
void |
setPort(int port)
Set the uri port.
|
void |
setQuery(String query)
Set the uri query String.
|
void |
setScheme(String scheme)
Set the uri scheme.
|
void |
setURI(String uri) |
static String |
stripPath(String path)
Strip parameters from a path.
|
String |
toString() |
public static final String __CHARSET
public static final boolean __CHARSET_IS_DEFAULT
public URI(URI uri) throws IllegalArgumentException
uri
- IllegalArgumentException
public URI(String uri) throws IllegalArgumentException
uri
- [scheme://host[:port]]/path[?query]IllegalArgumentException
public void setURI(String uri) throws IllegalArgumentException
IllegalArgumentException
public boolean isAbsolute()
public String getScheme()
public void setScheme(String scheme)
scheme
- the uri schemepublic String getHost()
public void setHost(String host)
host
- the uri hostpublic int getPort()
public void setPort(int port)
port
- the uri portpublic String getPath()
public String getEncodedPath()
public void setPath(String path)
path
- the URI pathpublic String getQuery()
public void setQuery(String query)
query
- the URI query stringpublic Set getParameterNames()
public MultiMap getParameters()
public Map getUnmodifiableParameters()
public void putParametersTo(MultiMap map)
public void clearParameters()
public void put(String encoded)
encoded
- A HTTP encoded string of _parameters: e.g.. "a=1&b=2"public Object put(Object name, Object value)
name
- name of valuevalue
- The value, which may be a multi valued list or
String array.public void put(Map values)
public List getValues(String name)
name
- The parameter namepublic void remove(String name)
public String toString()
public static String encodePath(String path)
path
- The path the encodepublic static StringBuffer encodePath(StringBuffer buf, String path)
path
- The path the encodebuf
- StringBuffer to encode path into (or null)public static StringBuffer encodeString(StringBuffer buf, String path, String encode)
path
- The path the encodebuf
- StringBuffer to encode path into (or null)encode
- String of characters to encode. % is always encoded.public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public static String addPaths(String p1, String p2)
p1
- URI path segmentp2
- URI path segmentpublic static String parentPath(String p)
public static String stripPath(String path)
public static String canonicalPath(String path)
path
- public static boolean hasScheme(String uri)
uri
- URICopyright © 2013. All rights reserved.