public class URI extends Object implements Cloneable, Comparable, Serializable
A URI is always in an "escaped" form, since escaping or unescaping a completed URI might change its semantics.
Implementers should be careful not to escape or unescape the same string more than once, since unescaping an already unescaped string might lead to misinterpreting a percent data character as another escaped character, or vice versa in the case of escaping an already escaped string.
In order to avoid these problems, data types used as follows:
URI character sequence: char octet sequence: byte original character sequence: String
So, a URI is a sequence of characters as an array of a char type, which is not always represented as a sequence of octets as an array of byte.
URI Syntactic Components
- In general, written as follows: Absolute URI = <scheme>:<scheme-specific-part> Generic URI = <scheme>://<authority><path>?<query> - Syntax absoluteURI = scheme ":" ( hier_part | opaque_part ) hier_part = ( net_path | abs_path ) [ "?" query ] net_path = "//" authority [ abs_path ] abs_path = "/" path_segments
The following examples illustrate URI that are in common use.
ftp://ftp.is.co.za/rfc/rfc1808.txt -- ftp scheme for File Transfer Protocol services gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles -- gopher scheme for Gopher and Gopher+ Protocol services http://www.math.uio.no/faq/compression-faq/part1.html -- http scheme for Hypertext Transfer Protocol services mailto:[email protected] -- mailto scheme for electronic mail addresses news:comp.infosystems.www.servers.unix -- news scheme for USENET news groups and articles telnet://melvyl.ucop.edu/ -- telnet scheme for interactive services via the TELNET ProtocolPlease, notice that there are many modifications from URL(RFC 1738) and relative URL(RFC 1808).
The expressions for a URI
For escaped URI forms - URI(char[]) // constructor - char[] getRawXxx() // method - String getEscapedXxx() // method - String toString() // methodFor unescaped URI forms - URI(String) // constructor - String getXXX() // method
Modifier and Type | Class and Description |
---|---|
static class |
URI.DefaultCharsetChanged
The charset-changed normal operation to represent to be required to
alert to user the fact the default charset is changed.
|
static class |
URI.LocaleToCharsetMap
A mapping to determine the (somewhat arbitrarily) preferred charset for a
given locale.
|
Modifier and Type | Field and Description |
---|---|
static BitSet |
allowed_abs_path
Those characters that are allowed for the abs_path.
|
static BitSet |
allowed_authority
Those characters that are allowed for the authority component.
|
static BitSet |
allowed_fragment
Those characters that are allowed for the fragment component.
|
static BitSet |
allowed_host
Those characters that are allowed for the host component.
|
static BitSet |
allowed_IPv6reference
Those characters that are allowed for the IPv6reference component.
|
static BitSet |
allowed_opaque_part
Those characters that are allowed for the opaque_part.
|
static BitSet |
allowed_query
Those characters that are allowed for the query component.
|
static BitSet |
allowed_reg_name
Those characters that are allowed for the reg_name.
|
static BitSet |
allowed_rel_path
Those characters that are allowed for the rel_path.
|
static BitSet |
allowed_userinfo
Those characters that are allowed for the userinfo component.
|
static BitSet |
allowed_within_authority
Those characters that are allowed for the authority component.
|
static BitSet |
allowed_within_path
Those characters that are allowed within the path.
|
static BitSet |
allowed_within_query
Those characters that are allowed within the query component.
|
static BitSet |
allowed_within_userinfo
Those characters that are allowed for within the userinfo component.
|
static BitSet |
control
BitSet for control.
|
static BitSet |
delims
BitSet for delims.
|
static BitSet |
disallowed_opaque_part
Disallowed opaque_part before escaping.
|
static BitSet |
disallowed_rel_path
Disallowed rel_path before escaping.
|
static BitSet |
space
BitSet for space.
|
static BitSet |
unwise
BitSet for unwise.
|
static BitSet |
within_userinfo
BitSet for within the userinfo component like user and password.
|
Constructor and Description |
---|
URI(char[] escaped)
Deprecated.
Use #URI(String, boolean)
|
URI(char[] escaped,
String charset)
Deprecated.
Use #URI(String, boolean, String)
|
URI(String original)
Deprecated.
Use #URI(String, boolean)
|
URI(String s,
boolean escaped)
Construct a URI from a string with the given charset.
|
URI(String s,
boolean escaped,
String charset)
Construct a URI from a string with the given charset.
|
URI(String original,
String charset)
Deprecated.
Use #URI(String, boolean, String)
|
URI(String scheme,
String schemeSpecificPart,
String fragment)
Construct a general URI from the given components.
|
URI(String scheme,
String userinfo,
String host,
int port)
Construct a general URI from the given components.
|
URI(String scheme,
String userinfo,
String host,
int port,
String path)
Construct a general URI from the given components.
|
URI(String scheme,
String userinfo,
String host,
int port,
String path,
String query)
Construct a general URI from the given components.
|
URI(String scheme,
String userinfo,
String host,
int port,
String path,
String query,
String fragment)
Construct a general URI from the given components.
|
URI(String scheme,
String host,
String path,
String fragment)
Construct a general URI from the given components.
|
URI(String scheme,
String authority,
String path,
String query,
String fragment)
Construct a general URI from the given components.
|
URI(URI base,
String relative)
Deprecated.
Use #URI(URI, String, boolean)
|
URI(URI base,
String relative,
boolean escaped)
Construct a general URI with the given relative URI string.
|
URI(URI base,
URI relative)
Construct a general URI with the given relative URI.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Create and return a copy of this object, the URI-reference containing
the userinfo component.
|
int |
compareTo(Object obj)
Compare this URI to another object.
|
boolean |
equals(Object obj)
Test an object if this URI is equal to another.
|
String |
getAboveHierPath()
Get the level above the this hierarchy level.
|
String |
getAuthority()
Get the authority.
|
String |
getCurrentHierPath()
Get the current hierarchy level.
|
static String |
getDefaultDocumentCharset()
Get the recommended default charset of the document.
|
static String |
getDefaultDocumentCharsetByLocale()
Get the default charset of the document by locale.
|
static String |
getDefaultDocumentCharsetByPlatform()
Get the default charset of the document by platform.
|
static String |
getDefaultProtocolCharset()
Get the default charset of the protocol.
|
String |
getEscapedAboveHierPath()
Get the level above the this hierarchy level.
|
String |
getEscapedAuthority()
Get the escaped authority.
|
String |
getEscapedCurrentHierPath()
Get the escaped current hierarchy level.
|
String |
getEscapedFragment()
Get the escaped fragment.
|
String |
getEscapedName()
Get the escaped basename of the path.
|
String |
getEscapedPath()
Get the escaped path.
|
String |
getEscapedPathQuery()
Get the escaped query.
|
String |
getEscapedQuery()
Get the escaped query.
|
String |
getEscapedURI()
It can be gotten the URI character sequence.
|
String |
getEscapedURIReference()
Get the escaped URI reference string.
|
String |
getEscapedUserinfo()
Get the escaped userinfo.
|
String |
getFragment()
Get the fragment.
|
String |
getHost()
Get the host.
|
String |
getName()
Get the basename of the path.
|
String |
getPath()
Get the path.
|
String |
getPathQuery()
Get the path and query.
|
int |
getPort()
Get the port.
|
String |
getProtocolCharset()
Get the protocol charset used by this current URI instance.
|
String |
getQuery()
Get the query.
|
char[] |
getRawAboveHierPath()
Get the level above the this hierarchy level.
|
char[] |
getRawAuthority()
Get the raw-escaped authority.
|
char[] |
getRawCurrentHierPath()
Get the raw-escaped current hierarchy level.
|
char[] |
getRawFragment()
Get the raw-escaped fragment.
|
char[] |
getRawHost()
Get the host.
|
char[] |
getRawName()
Get the raw-escaped basename of the path.
|
char[] |
getRawPath()
Get the raw-escaped path.
|
char[] |
getRawPathQuery()
Get the raw-escaped path and query.
|
char[] |
getRawQuery()
Get the raw-escaped query.
|
char[] |
getRawScheme()
Get the scheme.
|
char[] |
getRawURI()
It can be gotten the URI character sequence.
|
char[] |
getRawURIReference()
Get the URI reference character sequence.
|
char[] |
getRawUserinfo()
Get the raw-escaped userinfo.
|
String |
getScheme()
Get the scheme.
|
String |
getURI()
It can be gotten the URI character sequence.
|
String |
getURIReference()
Get the original URI reference string.
|
String |
getUserinfo()
Get the userinfo.
|
boolean |
hasAuthority()
Tell whether or not this URI has authority.
|
boolean |
hasFragment()
Tell whether or not this URI has fragment.
|
int |
hashCode()
Return a hash code for this URI.
|
boolean |
hasQuery()
Tell whether or not this URI has query.
|
boolean |
hasUserinfo()
Tell whether or not this URI has userinfo.
|
boolean |
isAbsoluteURI()
Tell whether or not this URI is absolute.
|
boolean |
isAbsPath()
Tell whether or not the relativeURI or hier_part of this URI is abs_path.
|
boolean |
isHierPart()
Tell whether or not the absoluteURI of this URI is hier_part.
|
boolean |
isHostname()
Tell whether or not the host part of this URI is hostname.
|
boolean |
isIPv4address()
Tell whether or not the host part of this URI is IPv4address.
|
boolean |
isIPv6reference()
Tell whether or not the host part of this URI is IPv6reference.
|
boolean |
isNetPath()
Tell whether or not the relativeURI or heir_part of this URI is net_path.
|
boolean |
isOpaquePart()
Tell whether or not the absoluteURI of this URI is opaque_part.
|
boolean |
isRegName()
Tell whether or not the authority component of this URI is reg_name.
|
boolean |
isRelativeURI()
Tell whether or not this URI is relative.
|
boolean |
isRelPath()
Tell whether or not the relativeURI of this URI is rel_path.
|
boolean |
isServer()
Tell whether or not the authority component of this URI is server.
|
void |
normalize()
Normalizes the path part of this URI.
|
static void |
setDefaultDocumentCharset(String charset)
Set the default charset of the document.
|
static void |
setDefaultProtocolCharset(String charset)
Set the default charset of the protocol.
|
void |
setEscapedAuthority(String escapedAuthority)
Set the authority.
|
void |
setEscapedFragment(String escapedFragment)
Set the escaped fragment string.
|
void |
setEscapedPath(String escapedPath)
Set the escaped path.
|
void |
setEscapedQuery(String escapedQuery)
Set the escaped query string.
|
void |
setFragment(String fragment)
Set the fragment.
|
void |
setPath(String path)
Set the path.
|
void |
setQuery(String query)
Set the query.
|
void |
setRawAuthority(char[] escapedAuthority)
Set the authority.
|
void |
setRawFragment(char[] escapedFragment)
Set the raw-escaped fragment.
|
void |
setRawPath(char[] escapedPath)
Set the raw-escaped path.
|
void |
setRawQuery(char[] escapedQuery)
Set the raw-escaped query.
|
String |
toString()
Get the escaped URI string.
|
public static final BitSet within_userinfo
public static final BitSet control
public static final BitSet space
public static final BitSet delims
public static final BitSet unwise
public static final BitSet disallowed_rel_path
public static final BitSet disallowed_opaque_part
public static final BitSet allowed_authority
public static final BitSet allowed_opaque_part
public static final BitSet allowed_reg_name
public static final BitSet allowed_userinfo
public static final BitSet allowed_within_userinfo
public static final BitSet allowed_IPv6reference
public static final BitSet allowed_host
public static final BitSet allowed_within_authority
public static final BitSet allowed_abs_path
public static final BitSet allowed_rel_path
public static final BitSet allowed_within_path
public static final BitSet allowed_query
public static final BitSet allowed_within_query
public static final BitSet allowed_fragment
public URI(String s, boolean escaped, String charset) throws URIException, NullPointerException
s
- URI character sequenceescaped
- true if URI character sequence is in escaped form.
false otherwise.charset
- the charset string to do escape encoding, if requiredURIException
- If the URI cannot be created.NullPointerException
- if input string is null
getProtocolCharset()
public URI(String s, boolean escaped) throws URIException, NullPointerException
s
- URI character sequenceescaped
- true if URI character sequence is in escaped form.
false otherwise.URIException
- If the URI cannot be created.NullPointerException
- if input string is null
getProtocolCharset()
public URI(char[] escaped, String charset) throws URIException, NullPointerException
escaped
- the URI character sequencecharset
- the charset string to do escape encodingURIException
- If the URI cannot be created.NullPointerException
- if escaped
is null
getProtocolCharset()
public URI(char[] escaped) throws URIException, NullPointerException
escaped
- the URI character sequenceURIException
- If the URI cannot be created.NullPointerException
- if escaped
is null
getDefaultProtocolCharset()
public URI(String original, String charset) throws URIException
original
- the string to be represented to URI character sequence
It is one of absoluteURI and relativeURI.charset
- the charset string to do escape encodingURIException
- If the URI cannot be created.getProtocolCharset()
public URI(String original) throws URIException
URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
An URI can be placed within double-quotes or angle brackets like "http://test.com/" and <http://test.com/>
original
- the string to be represented to URI character sequence
It is one of absoluteURI and relativeURI.URIException
- If the URI cannot be created.getDefaultProtocolCharset()
public URI(String scheme, String schemeSpecificPart, String fragment) throws URIException
URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] absoluteURI = scheme ":" ( hier_part | opaque_part ) opaque_part = uric_no_slash *uric
It's for absolute URI = <scheme>:<scheme-specific-part># <fragment>.
scheme
- the scheme stringschemeSpecificPart
- scheme_specific_partfragment
- the fragment stringURIException
- If the URI cannot be created.getDefaultProtocolCharset()
public URI(String scheme, String authority, String path, String query, String fragment) throws URIException
URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] absoluteURI = scheme ":" ( hier_part | opaque_part ) relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ] hier_part = ( net_path | abs_path ) [ "?" query ]
It's for absolute URI = <scheme>:<path>?<query>#< fragment> and relative URI = <path>?<query>#<fragment >.
scheme
- the scheme stringauthority
- the authority stringpath
- the path stringquery
- the query stringfragment
- the fragment stringURIException
- If the new URI cannot be created.getDefaultProtocolCharset()
public URI(String scheme, String userinfo, String host, int port) throws URIException
scheme
- the scheme stringuserinfo
- the userinfo stringhost
- the host stringport
- the port numberURIException
- If the new URI cannot be created.getDefaultProtocolCharset()
public URI(String scheme, String userinfo, String host, int port, String path) throws URIException
scheme
- the scheme stringuserinfo
- the userinfo stringhost
- the host stringport
- the port numberpath
- the path stringURIException
- If the new URI cannot be created.getDefaultProtocolCharset()
public URI(String scheme, String userinfo, String host, int port, String path, String query) throws URIException
scheme
- the scheme stringuserinfo
- the userinfo stringhost
- the host stringport
- the port numberpath
- the path stringquery
- the query stringURIException
- If the new URI cannot be created.getDefaultProtocolCharset()
public URI(String scheme, String userinfo, String host, int port, String path, String query, String fragment) throws URIException
scheme
- the scheme stringuserinfo
- the userinfo stringhost
- the host stringport
- the port numberpath
- the path stringquery
- the query stringfragment
- the fragment stringURIException
- If the new URI cannot be created.getDefaultProtocolCharset()
public URI(String scheme, String host, String path, String fragment) throws URIException
scheme
- the scheme stringhost
- the host stringpath
- the path stringfragment
- the fragment stringURIException
- If the new URI cannot be created.getDefaultProtocolCharset()
public URI(URI base, String relative) throws URIException
base
- the base URIrelative
- the relative URI stringURIException
- If the new URI cannot be created.public URI(URI base, String relative, boolean escaped) throws URIException
base
- the base URIrelative
- the relative URI stringescaped
- true if URI character sequence is in escaped form.
false otherwise.URIException
- If the new URI cannot be created.public URI(URI base, URI relative) throws URIException
URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ] relativeURI = ( net_path | abs_path | rel_path ) [ "?" query ]
Resolving Relative References to Absolute Form. Examples of Resolving Relative URI References Within an object with a well-defined base URI of
http://a/b/c/d;p?q
the relative URI would be resolved as follows: Normal Examples
g:h = g:h g = http://a/b/c/g ./g = http://a/b/c/g g/ = http://a/b/c/g/ /g = http://a/g //g = http://g ?y = http://a/b/c/?y g?y = http://a/b/c/g?y #s = (current document)#s g#s = http://a/b/c/g#s g?y#s = http://a/b/c/g?y#s ;x = http://a/b/c/;x g;x = http://a/b/c/g;x g;x?y#s = http://a/b/c/g;x?y#s . = http://a/b/c/ ./ = http://a/b/c/ .. = http://a/b/ ../ = http://a/b/ ../g = http://a/b/g ../.. = http://a/ ../../ = http://a/ ../../g = http://a/g
Some URI schemes do not allow a hierarchical syntax matching the
base
- the base URIrelative
- the relative URIURIException
- If the new URI cannot be created.public boolean isAbsoluteURI()
public boolean isRelativeURI()
public boolean isHierPart()
public boolean isOpaquePart()
public boolean isNetPath()
hasAuthority()
public boolean isAbsPath()
public boolean isRelPath()
public boolean hasAuthority()
isNetPath()
public boolean isRegName()
public boolean isServer()
public boolean hasUserinfo()
public boolean isHostname()
public boolean isIPv4address()
public boolean isIPv6reference()
public boolean hasQuery()
public boolean hasFragment()
public static void setDefaultProtocolCharset(String charset) throws URI.DefaultCharsetChanged
The character set used to store files SHALL remain a local decision and MAY depend on the capability of local operating systems. Prior to the exchange of URIs they SHOULD be converted into a ISO/IEC 10646 format and UTF-8 encoded. This approach, while allowing international exchange of URIs, will still allow backward compatibility with older systems because the code set positions for ASCII characters are identical to the one byte sequence in UTF-8.
An individual URI scheme may require a single charset, define a default charset, or provide a way to indicate the charset used.
Always all the time, the setter method is always succeeded and throws
DefaultCharsetChanged
exception.
So API programmer must follow the following way:
The API programmer is responsible to set the correct charset.
And each application should remember its own charset to support.
import org.apache.util.URI$DefaultCharsetChanged;
.
.
.
try {
URI.setDefaultProtocolCharset("UTF-8");
} catch (DefaultCharsetChanged cc) {
// CASE 1: the exception could be ignored, when it is set by user
if (cc.getReasonCode() == DefaultCharsetChanged.PROTOCOL_CHARSET) {
// CASE 2: let user know the default protocol charset changed
} else {
// CASE 2: let user know the default document charset changed
}
}
charset
- the default charset for each protocolURI.DefaultCharsetChanged
- default charset changedpublic static String getDefaultProtocolCharset()
An individual URI scheme may require a single charset, define a default charset, or provide a way to indicate the charset used.
To work globally either requires support of a number of character sets and to be able to convert between them, or the use of a single preferred character set. For support of global compatibility it is STRONGLY RECOMMENDED that clients and servers use UTF-8 encoding when exchanging URIs.
public String getProtocolCharset()
getDefaultProtocolCharset()
public static void setDefaultDocumentCharset(String charset) throws URI.DefaultCharsetChanged
Notice that it will be possible to contain mixed characters (e.g. ftp://host/KoreanNamespace/ChineseResource). To handle the Bi-directional display of these character sets, the protocol charset could be simply used again. Because it's not yet implemented that the insertion of BIDI control characters at different points during composition is extracted.
Always all the time, the setter method is always succeeded and throws
DefaultCharsetChanged
exception.
So API programmer must follow the following way:
The API programmer is responsible to set the correct charset.
And each application should remember its own charset to support.
import org.apache.util.URI$DefaultCharsetChanged;
.
.
.
try {
URI.setDefaultDocumentCharset("EUC-KR");
} catch (DefaultCharsetChanged cc) {
// CASE 1: the exception could be ignored, when it is set by user
if (cc.getReasonCode() == DefaultCharsetChanged.DOCUMENT_CHARSET) {
// CASE 2: let user know the default document charset changed
} else {
// CASE 2: let user know the default protocol charset changed
}
}
charset
- the default charset for the documentURI.DefaultCharsetChanged
- default charset changedpublic static String getDefaultDocumentCharset()
public static String getDefaultDocumentCharsetByLocale()
public static String getDefaultDocumentCharsetByPlatform()
public char[] getRawScheme()
public String getScheme()
public void setRawAuthority(char[] escapedAuthority) throws URIException, NullPointerException
authority = server | reg_name
escapedAuthority
- the raw escaped authorityURIException
- If parseAuthority(java.lang.String,boolean)
failsNullPointerException
- null authoritypublic void setEscapedAuthority(String escapedAuthority) throws URIException
escapedAuthority
- the escaped authority stringURIException
- If parseAuthority(java.lang.String,boolean)
failspublic char[] getRawAuthority()
public String getEscapedAuthority()
public String getAuthority() throws URIException
URIException
- If decode(char[], java.lang.String)
failspublic char[] getRawUserinfo()
getAuthority()
public String getEscapedUserinfo()
getAuthority()
public String getUserinfo() throws URIException
URIException
- If decode(char[], java.lang.String)
failsgetAuthority()
public char[] getRawHost()
host = hostname | IPv4address | IPv6reference
getAuthority()
public String getHost() throws URIException
host = hostname | IPv4address | IPv6reference
URIException
- If decode(char[], java.lang.String)
failsgetAuthority()
public int getPort()
public void setRawPath(char[] escapedPath) throws URIException
escapedPath
- the path character sequenceURIException
- encoding error or not proper for initial instanceencode(java.lang.String, java.util.BitSet, java.lang.String)
public void setEscapedPath(String escapedPath) throws URIException
escapedPath
- the escaped path stringURIException
- encoding error or not proper for initial instanceencode(java.lang.String, java.util.BitSet, java.lang.String)
public void setPath(String path) throws URIException
path
- the path stringURIException
- set incorrectly or fragment onlyencode(java.lang.String, java.util.BitSet, java.lang.String)
public char[] getRawCurrentHierPath() throws URIException
URIException
- If getRawCurrentHierPath(char[])
fails.public String getEscapedCurrentHierPath() throws URIException
URIException
- If getRawCurrentHierPath(char[])
fails.public String getCurrentHierPath() throws URIException
URIException
- If getRawCurrentHierPath(char[])
fails.decode(char[], java.lang.String)
public char[] getRawAboveHierPath() throws URIException
URIException
- If getRawCurrentHierPath(char[])
fails.public String getEscapedAboveHierPath() throws URIException
URIException
- If getRawCurrentHierPath(char[])
fails.public String getAboveHierPath() throws URIException
URIException
- If getRawCurrentHierPath(char[])
fails.decode(char[], java.lang.String)
public char[] getRawPath()
path = [ abs_path | opaque_part ]
public String getEscapedPath()
path = [ abs_path | opaque_part ] abs_path = "/" path_segments opaque_part = uric_no_slash *uric
public String getPath() throws URIException
path = [ abs_path | opaque_part ]
URIException
- If decode(char[], java.lang.String)
fails.decode(char[], java.lang.String)
public char[] getRawName()
public String getEscapedName()
public String getName() throws URIException
URIException
- incomplete trailing escape pattern or unsupported
character encodingdecode(char[], java.lang.String)
public char[] getRawPathQuery()
public String getEscapedPathQuery()
public String getPathQuery() throws URIException
URIException
- incomplete trailing escape pattern or unsupported
character encodingdecode(char[], java.lang.String)
public void setRawQuery(char[] escapedQuery) throws URIException
escapedQuery
- the raw-escaped queryURIException
- escaped query not validpublic void setEscapedQuery(String escapedQuery) throws URIException
escapedQuery
- the escaped query stringURIException
- escaped query not validpublic void setQuery(String query) throws URIException
When a query string is not misunderstood the reserved special characters ("&", "=", "+", ",", and "$") within a query component, it is recommended to use in encoding the whole query with this method.
The additional APIs for the special purpose using by the reserved
special characters used in each protocol are implemented in each protocol
classes inherited from URI
. So refer to the same-named APIs
implemented in each specific protocol instance.
query
- the query string.URIException
- incomplete trailing escape pattern or unsupported
character encodingencode(java.lang.String, java.util.BitSet, java.lang.String)
public char[] getRawQuery()
public String getEscapedQuery()
public String getQuery() throws URIException
URIException
- incomplete trailing escape pattern or unsupported
character encodingdecode(char[], java.lang.String)
public void setRawFragment(char[] escapedFragment) throws URIException
escapedFragment
- the raw-escaped fragmentURIException
- escaped fragment not validpublic void setEscapedFragment(String escapedFragment) throws URIException
escapedFragment
- the escaped fragment stringURIException
- escaped fragment not validpublic void setFragment(String fragment) throws URIException
fragment
- the fragment string.URIException
- If an error occurs.public char[] getRawFragment()
The optional fragment identifier is not part of a URI, but is often used in conjunction with a URI.
The format and interpretation of fragment identifiers is dependent on the media type [RFC2046] of the retrieval result.
A fragment identifier is only meaningful when a URI reference is intended for retrieval and the result of that retrieval is a document for which the identified fragment is consistently defined.
public String getEscapedFragment()
public String getFragment() throws URIException
URIException
- incomplete trailing escape pattern or unsupported
character encodingdecode(char[], java.lang.String)
public void normalize() throws URIException
URIException
- no more higher path level to be normalizedisAbsPath()
public boolean equals(Object obj)
public int hashCode()
public int compareTo(Object obj) throws ClassCastException
compareTo
in interface Comparable
obj
- the object to be compared.ClassCastException
- not URI argumentpublic Object clone() throws CloneNotSupportedException
String
.
To copy the identical URI
object including the userinfo
component, it should be used.
clone
in class Object
CloneNotSupportedException
public char[] getRawURI()
It is clearly unwise to use a URL that contains a password which is intended to be secret. In particular, the use of a password within the 'userinfo' component of a URL is strongly disrecommended except in those rare cases where the 'password' parameter is intended to be public.
When you want to get each part of the userinfo, you need to use the specific methods in the specific URL. It depends on the specific URL.
public String getEscapedURI()
public String getURI() throws URIException
URIException
- incomplete trailing escape pattern or unsupported
character encodingdecode(char[], java.lang.String)
public char[] getRawURIReference()
public String getEscapedURIReference()
public String getURIReference() throws URIException
URIException
- If decode(char[], java.lang.String)
fails.public String toString()
On the document, the URI-reference form is only used without the userinfo component like http://jakarta.apache.org/ by the security reason. But the URI-reference form with the userinfo component could be parsed.
In other words, this URI and any its subclasses must not expose the
URI-reference expression with the userinfo component like
http://user:password@hostport/restricted_zone.
It means that the API client programmer should extract each user and
password to access manually. Probably it will be supported in the each
subclass, however, not a whole URI-reference expression.
Copyright © 2010 - 2020 Adobe. All Rights Reserved