|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.jndi.toolkit.url.Uri
public class Uri
A Uri object represents an absolute Uniform Resource Identifier (URI) as defined by RFC 2396 and updated by RFC 2373 and RFC 2732. The most commonly used form of URI is the Uniform Resource Locator (URL).
The java.net.URL class cannot be used to parse URIs since it requires the installation of URL stream handlers that may not be available. The hack of getting around this by temporarily replacing the scheme part of a URI is not appropriate here: JNDI service providers must work on older Java platforms, and we want new features and bug fixes that are not available in old versions of the URL class.
It may be appropriate to drop this code in favor of the java.net.URI class. The changes would need to be written so as to still run on pre-1.4 platforms not containing that class.
The format of an absolute URI (see the RFCs mentioned above) is:
absoluteURI = scheme ":" ( hier_part | opaque_part )
scheme = alpha *( alpha | digit | "+" | "-" | "." )
hier_part = ( net_path | abs_path ) [ "?" query ]
opaque_part = uric_no_slash *uric
net_path = "//" authority [ abs_path ]
abs_path = "/" path_segments
authority = server | reg_name
reg_name = 1*( unreserved | escaped | "$" | "," |
";" | ":" | "@" | "&" | "=" | "+" )
server = [ [ userinfo "@" ] hostport ]
userinfo = *( unreserved | escaped |
";" | ":" | "&" | "=" | "+" | "$" | "," )
hostport = host [ ":" port ]
host = hostname | IPv4address | IPv6reference
port = *digit
IPv6reference = "[" IPv6address "]"
IPv6address = hexpart [ ":" IPv4address ]
IPv4address = 1*3digit "." 1*3digit "." 1*3digit "." 1*3digit
hexpart = hexseq | hexseq "::" [ hexseq ] | "::" [ hexseq ]
hexseq = hex4 *( ":" hex4)
hex4 = 1*4hex
path = [ abs_path | opaque_part ]
path_segments = segment *( "/" segment )
segment = *pchar *( ";" param )
param = *pchar
pchar = unreserved | escaped |
":" | "@" | "&" | "=" | "+" | "$" | ","
query = *uric
uric = reserved | unreserved | escaped
uric_no_slash = unreserved | escaped | ";" | "?" | ":" | "@" |
"&" | "=" | "+" | "$" | ","
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
"$" | "," | "[" | "]"
unreserved = alphanum | mark
mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
escaped = "%" hex hex
unwise = "{" | "}" | "|" | "\" | "^" | "`"
Currently URIs containing userinfo or reg_name are not supported. The opaque_part of a non-hierarchical URI is treated as if if were a path without a leading slash.
| Field Summary | |
|---|---|
protected boolean |
hasAuthority
|
protected String |
host
|
protected String |
path
|
protected int |
port
|
protected String |
query
|
protected String |
scheme
|
protected String |
uri
|
| Constructor Summary | |
|---|---|
protected |
Uri()
Creates an uninitialized Uri object. |
|
Uri(String uri)
Creates a Uri object given a URI string. |
| Method Summary | |
|---|---|
String |
getHost()
Returns the host from the URI's authority part, or null if no host is provided. |
String |
getPath()
Returns the URI's path. |
int |
getPort()
Returns the port from the URI's authority part, or -1 if no port is provided. |
String |
getQuery()
Returns the URI's query part, or null if no query is provided. |
String |
getScheme()
Returns the URI's scheme. |
protected void |
init(String uri)
Initializes a Uri object given a URI string. |
String |
toString()
Returns the URI as a string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String uri
protected String scheme
protected String host
protected int port
protected boolean hasAuthority
protected String path
protected String query
| Constructor Detail |
|---|
public Uri(String uri)
throws MalformedURLException
MalformedURLExceptionprotected Uri()
| Method Detail |
|---|
protected void init(String uri)
throws MalformedURLException
MalformedURLExceptionpublic String getScheme()
public String getHost()
URI.getHost()).
public int getPort()
public String getPath()
public String getQuery()
public String toString()
toString in class Object
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||