Class URI
- All Implemented Interfaces:
Serializable,Cloneable,Comparable
- Direct Known Subclasses:
HttpURL
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 = <schemeinvalid input: '>':<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:mduerst@ifi.unizh.ch
-- 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 Protocol
Please, 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
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.The charset-changed normal operation to represent to be required to alert to user the fact the default charset is changed.static classDeprecated.A mapping to determine the (somewhat arbitrarily) preferred charset for a given locale. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BitSetDeprecated.Those characters that are allowed for the abs_path.static final BitSetDeprecated.Those characters that are allowed for the authority component.static final BitSetDeprecated.Those characters that are allowed for the fragment component.static final BitSetDeprecated.Those characters that are allowed for the host component.static final BitSetDeprecated.Those characters that are allowed for the IPv6reference component.static final BitSetDeprecated.Those characters that are allowed for the opaque_part.static final BitSetDeprecated.Those characters that are allowed for the query component.static final BitSetDeprecated.Those characters that are allowed for the reg_name.static final BitSetDeprecated.Those characters that are allowed for the rel_path.static final BitSetDeprecated.Those characters that are allowed for the userinfo component.static final BitSetDeprecated.Those characters that are allowed for the authority component.static final BitSetDeprecated.Those characters that are allowed within the path.static final BitSetDeprecated.Those characters that are allowed within the query component.static final BitSetDeprecated.Those characters that are allowed for within the userinfo component.static final BitSetDeprecated.BitSet for control.static final BitSetDeprecated.BitSet for delims.static final BitSetDeprecated.Disallowed opaque_part before escaping.static final BitSetDeprecated.Disallowed rel_path before escaping.static final BitSetDeprecated.BitSet for space.static final BitSetDeprecated.BitSet for unwise.static final BitSetDeprecated.BitSet for within the userinfo component like user and password. -
Constructor Summary
ConstructorsConstructorDescriptionURI(char[] escaped) Deprecated.Use #URI(String, boolean)Deprecated.Use #URI(String, boolean, String)Deprecated.Use #URI(String, boolean)Deprecated.Construct a URI from a string with the given charset.Deprecated.Construct a URI from a string with the given charset.Deprecated.Use #URI(String, boolean, String)Deprecated.Construct a general URI from the given components.Deprecated.Construct a general URI from the given components.Deprecated.Construct a general URI from the given components.Deprecated.Construct a general URI from the given components.URI(String scheme, String userinfo, String host, int port, String path, String query, String fragment) Deprecated.Construct a general URI from the given components.Deprecated.Construct a general URI from the given components.Deprecated.Construct a general URI from the given components.Deprecated.Use #URI(URI, String, boolean)Deprecated.Construct a general URI with the given relative URI string.Deprecated.Construct a general URI with the given relative URI. -
Method Summary
Modifier and TypeMethodDescriptionclone()Deprecated.Create and return a copy of this object, the URI-reference containing the userinfo component.intDeprecated.Compare this URI to another object.booleanDeprecated.Test an object if this URI is equal to another.Deprecated.Get the level above the this hierarchy level.Deprecated.Get the authority.Deprecated.Get the current hierarchy level.static StringDeprecated.Get the recommended default charset of the document.static StringDeprecated.Get the default charset of the document by locale.static StringDeprecated.Get the default charset of the document by platform.static StringDeprecated.Get the default charset of the protocol.Deprecated.Get the level above the this hierarchy level.Deprecated.Get the escaped authority.Deprecated.Get the escaped current hierarchy level.Deprecated.Get the escaped fragment.Deprecated.Get the escaped basename of the path.Deprecated.Get the escaped path.Deprecated.Get the escaped query.Deprecated.Get the escaped query.Deprecated.It can be gotten the URI character sequence.Deprecated.Get the escaped URI reference string.Deprecated.Get the escaped userinfo.Deprecated.Get the fragment.getHost()Deprecated.Get the host.getName()Deprecated.Get the basename of the path.getPath()Deprecated.Get the path.Deprecated.Get the path and query.intgetPort()Deprecated.Get the port.Deprecated.Get the protocol charset used by this current URI instance.getQuery()Deprecated.Get the query.char[]Deprecated.Get the level above the this hierarchy level.char[]Deprecated.Get the raw-escaped authority.char[]Deprecated.Get the raw-escaped current hierarchy level.char[]Deprecated.Get the raw-escaped fragment.char[]Deprecated.Get the host.char[]Deprecated.Get the raw-escaped basename of the path.char[]Deprecated.Get the raw-escaped path.char[]Deprecated.Get the raw-escaped path and query.char[]Deprecated.Get the raw-escaped query.char[]Deprecated.Get the scheme.char[]Deprecated.It can be gotten the URI character sequence.char[]Deprecated.Get the URI reference character sequence.char[]Deprecated.Get the raw-escaped userinfo.Deprecated.Get the scheme.getURI()Deprecated.It can be gotten the URI character sequence.Deprecated.Get the original URI reference string.Deprecated.Get the userinfo.booleanDeprecated.Tell whether or not this URI has authority.booleanDeprecated.Tell whether or not this URI has fragment.inthashCode()Deprecated.Return a hash code for this URI.booleanhasQuery()Deprecated.Tell whether or not this URI has query.booleanDeprecated.Tell whether or not this URI has userinfo.booleanDeprecated.Tell whether or not this URI is absolute.booleanDeprecated.Tell whether or not the relativeURI or hier_part of this URI is abs_path.booleanDeprecated.Tell whether or not the absoluteURI of this URI is hier_part.booleanDeprecated.Tell whether or not the host part of this URI is hostname.booleanDeprecated.Tell whether or not the host part of this URI is IPv4address.booleanDeprecated.Tell whether or not the host part of this URI is IPv6reference.booleanDeprecated.Tell whether or not the relativeURI or heir_part of this URI is net_path.booleanDeprecated.Tell whether or not the absoluteURI of this URI is opaque_part.booleanDeprecated.Tell whether or not the authority component of this URI is reg_name.booleanDeprecated.Tell whether or not this URI is relative.booleanDeprecated.Tell whether or not the relativeURI of this URI is rel_path.booleanisServer()Deprecated.Tell whether or not the authority component of this URI is server.voidDeprecated.Normalizes the path part of this URI.static voidsetDefaultDocumentCharset(String charset) Deprecated.Set the default charset of the document.static voidsetDefaultProtocolCharset(String charset) Deprecated.Set the default charset of the protocol.voidsetEscapedAuthority(String escapedAuthority) Deprecated.Set the authority.voidsetEscapedFragment(String escapedFragment) Deprecated.Set the escaped fragment string.voidsetEscapedPath(String escapedPath) Deprecated.Set the escaped path.voidsetEscapedQuery(String escapedQuery) Deprecated.Set the escaped query string.voidsetFragment(String fragment) Deprecated.Set the fragment.voidDeprecated.Set the path.voidDeprecated.Set the query.voidsetRawAuthority(char[] escapedAuthority) Deprecated.Set the authority.voidsetRawFragment(char[] escapedFragment) Deprecated.Set the raw-escaped fragment.voidsetRawPath(char[] escapedPath) Deprecated.Set the raw-escaped path.voidsetRawQuery(char[] escapedQuery) Deprecated.Set the raw-escaped query.toString()Deprecated.Get the escaped URI string.
-
Field Details
-
within_userinfo
Deprecated.BitSet for within the userinfo component like user and password. -
control
Deprecated.BitSet for control. -
space
Deprecated.BitSet for space. -
delims
Deprecated.BitSet for delims. -
unwise
Deprecated.BitSet for unwise. -
disallowed_rel_path
Deprecated.Disallowed rel_path before escaping. -
disallowed_opaque_part
Deprecated.Disallowed opaque_part before escaping. -
allowed_authority
Deprecated.Those characters that are allowed for the authority component. -
allowed_opaque_part
Deprecated.Those characters that are allowed for the opaque_part. -
allowed_reg_name
Deprecated.Those characters that are allowed for the reg_name. -
allowed_userinfo
Deprecated.Those characters that are allowed for the userinfo component. -
allowed_within_userinfo
Deprecated.Those characters that are allowed for within the userinfo component. -
allowed_IPv6reference
Deprecated.Those characters that are allowed for the IPv6reference component. The characters '[', ']' in IPv6reference should be excluded. -
allowed_host
Deprecated.Those characters that are allowed for the host component. The characters '[', ']' in IPv6reference should be excluded. -
allowed_within_authority
Deprecated.Those characters that are allowed for the authority component. -
allowed_abs_path
Deprecated.Those characters that are allowed for the abs_path. -
allowed_rel_path
Deprecated.Those characters that are allowed for the rel_path. -
allowed_within_path
Deprecated.Those characters that are allowed within the path. -
allowed_query
Deprecated.Those characters that are allowed for the query component. -
allowed_within_query
Deprecated.Those characters that are allowed within the query component. -
allowed_fragment
Deprecated.Those characters that are allowed for the fragment component.
-
-
Constructor Details
-
URI
Deprecated.Construct a URI from a string with the given charset. The input string can be either in escaped or unescaped form.- Parameters:
s- URI character sequenceescaped- true if URI character sequence is in escaped form. false otherwise.charset- the charset string to do escape encoding, if required- Throws:
URIException- If the URI cannot be created.NullPointerException- if input string isnull- Since:
- 3.0
- See Also:
-
URI
Deprecated.Construct a URI from a string with the given charset. The input string can be either in escaped or unescaped form.- Parameters:
s- URI character sequenceescaped- true if URI character sequence is in escaped form. false otherwise.- Throws:
URIException- If the URI cannot be created.NullPointerException- if input string isnull- Since:
- 3.0
- See Also:
-
URI
Deprecated.Use #URI(String, boolean, String)Construct a URI as an escaped form of a character array with the given charset.- Parameters:
escaped- the URI character sequencecharset- the charset string to do escape encoding- Throws:
URIException- If the URI cannot be created.NullPointerException- ifescapedisnull- See Also:
-
URI
Deprecated.Use #URI(String, boolean)Construct a URI as an escaped form of a character array. An URI can be placed within double-quotes or angle brackets like "http://test.com/" and <http://test.com/>- Parameters:
escaped- the URI character sequence- Throws:
URIException- If the URI cannot be created.NullPointerException- ifescapedisnull- See Also:
-
URI
Deprecated.Use #URI(String, boolean, String)Construct a URI from the given string with the given charset.- Parameters:
original- the string to be represented to URI character sequence It is one of absoluteURI and relativeURI.charset- the charset string to do escape encoding- Throws:
URIException- If the URI cannot be created.- See Also:
-
URI
Deprecated.Use #URI(String, boolean)Construct a URI from the given string.URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
An URI can be placed within double-quotes or angle brackets like "http://test.com/" and <http://test.com/>
- Parameters:
original- the string to be represented to URI character sequence It is one of absoluteURI and relativeURI.- Throws:
URIException- If the URI cannot be created.- See Also:
-
URI
Deprecated.Construct a general URI from the given components.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>.
- Parameters:
scheme- the scheme stringschemeSpecificPart- scheme_specific_partfragment- the fragment string- Throws:
URIException- If the URI cannot be created.- See Also:
-
URI
public URI(String scheme, String authority, String path, String query, String fragment) throws URIException Deprecated.Construct a general URI from the given components.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 >.
- Parameters:
scheme- the scheme stringauthority- the authority stringpath- the path stringquery- the query stringfragment- the fragment string- Throws:
URIException- If the new URI cannot be created.- See Also:
-
URI
Deprecated.Construct a general URI from the given components.- Parameters:
scheme- the scheme stringuserinfo- the userinfo stringhost- the host stringport- the port number- Throws:
URIException- If the new URI cannot be created.- See Also:
-
URI
Deprecated.Construct a general URI from the given components.- Parameters:
scheme- the scheme stringuserinfo- the userinfo stringhost- the host stringport- the port numberpath- the path string- Throws:
URIException- If the new URI cannot be created.- See Also:
-
URI
public URI(String scheme, String userinfo, String host, int port, String path, String query) throws URIException Deprecated.Construct a general URI from the given components.- Parameters:
scheme- the scheme stringuserinfo- the userinfo stringhost- the host stringport- the port numberpath- the path stringquery- the query string- Throws:
URIException- If the new URI cannot be created.- See Also:
-
URI
public URI(String scheme, String userinfo, String host, int port, String path, String query, String fragment) throws URIException Deprecated.Construct a general URI from the given components.- Parameters:
scheme- the scheme stringuserinfo- the userinfo stringhost- the host stringport- the port numberpath- the path stringquery- the query stringfragment- the fragment string- Throws:
URIException- If the new URI cannot be created.- See Also:
-
URI
Deprecated.Construct a general URI from the given components.- Parameters:
scheme- the scheme stringhost- the host stringpath- the path stringfragment- the fragment string- Throws:
URIException- If the new URI cannot be created.- See Also:
-
URI
Deprecated.Use #URI(URI, String, boolean)Construct a general URI with the given relative URI string.- Parameters:
base- the base URIrelative- the relative URI string- Throws:
URIException- If the new URI cannot be created.
-
URI
Deprecated.Construct a general URI with the given relative URI string.- Parameters:
base- the base URIrelative- the relative URI stringescaped- true if URI character sequence is in escaped form. false otherwise.- Throws:
URIException- If the new URI cannot be created.- Since:
- 3.0
-
URI
Deprecated.Construct a general URI with the given relative URI.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
syntax, and thus cannot use relative references. - Parameters:
base- the base URIrelative- the relative URI- Throws:
URIException- If the new URI cannot be created.
-
-
Method Details
-
isAbsoluteURI
public boolean isAbsoluteURI()Deprecated.Tell whether or not this URI is absolute.- Returns:
- true iif this URI is absoluteURI
-
isRelativeURI
public boolean isRelativeURI()Deprecated.Tell whether or not this URI is relative.- Returns:
- true iif this URI is relativeURI
-
isHierPart
public boolean isHierPart()Deprecated.Tell whether or not the absoluteURI of this URI is hier_part.- Returns:
- true iif the absoluteURI is hier_part
-
isOpaquePart
public boolean isOpaquePart()Deprecated.Tell whether or not the absoluteURI of this URI is opaque_part.- Returns:
- true iif the absoluteURI is opaque_part
-
isNetPath
public boolean isNetPath()Deprecated.Tell whether or not the relativeURI or heir_part of this URI is net_path. It's the same function as the has_authority() method.- Returns:
- true iif the relativeURI or heir_part is net_path
- See Also:
-
isAbsPath
public boolean isAbsPath()Deprecated.Tell whether or not the relativeURI or hier_part of this URI is abs_path.- Returns:
- true iif the relativeURI or hier_part is abs_path
-
isRelPath
public boolean isRelPath()Deprecated.Tell whether or not the relativeURI of this URI is rel_path.- Returns:
- true iif the relativeURI is rel_path
-
hasAuthority
public boolean hasAuthority()Deprecated.Tell whether or not this URI has authority. It's the same function as the is_net_path() method.- Returns:
- true iif this URI has authority
- See Also:
-
isRegName
public boolean isRegName()Deprecated.Tell whether or not the authority component of this URI is reg_name.- Returns:
- true iif the authority component is reg_name
-
isServer
public boolean isServer()Deprecated.Tell whether or not the authority component of this URI is server.- Returns:
- true iif the authority component is server
-
hasUserinfo
public boolean hasUserinfo()Deprecated.Tell whether or not this URI has userinfo.- Returns:
- true iif this URI has userinfo
-
isHostname
public boolean isHostname()Deprecated.Tell whether or not the host part of this URI is hostname.- Returns:
- true iif the host part is hostname
-
isIPv4address
public boolean isIPv4address()Deprecated.Tell whether or not the host part of this URI is IPv4address.- Returns:
- true iif the host part is IPv4address
-
isIPv6reference
public boolean isIPv6reference()Deprecated.Tell whether or not the host part of this URI is IPv6reference.- Returns:
- true iif the host part is IPv6reference
-
hasQuery
public boolean hasQuery()Deprecated.Tell whether or not this URI has query.- Returns:
- true iif this URI has query
-
hasFragment
public boolean hasFragment()Deprecated.Tell whether or not this URI has fragment.- Returns:
- true iif this URI has fragment
-
setDefaultProtocolCharset
Deprecated.Set the default charset of the protocol.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
DefaultCharsetChangedexception. 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 } }- Parameters:
charset- the default charset for each protocol- Throws:
URI.DefaultCharsetChanged- default charset changed
-
getDefaultProtocolCharset
Deprecated.Get the default charset of the protocol.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.
- Returns:
- the default charset string
-
getProtocolCharset
Deprecated.Get the protocol charset used by this current URI instance. It was set by the constructor for this instance. If it was not set by contructor, it will return the default protocol charset.- Returns:
- the protocol charset string
- See Also:
-
setDefaultDocumentCharset
Deprecated.Set the default charset of the document.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
DefaultCharsetChangedexception. 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 } }- Parameters:
charset- the default charset for the document- Throws:
URI.DefaultCharsetChanged- default charset changed
-
getDefaultDocumentCharset
Deprecated.Get the recommended default charset of the document.- Returns:
- the default charset string
-
getDefaultDocumentCharsetByLocale
Deprecated.Get the default charset of the document by locale.- Returns:
- the default charset string by locale
-
getDefaultDocumentCharsetByPlatform
Deprecated.Get the default charset of the document by platform.- Returns:
- the default charset string by platform
-
getRawScheme
public char[] getRawScheme()Deprecated.Get the scheme.- Returns:
- the scheme
-
getScheme
Deprecated.Get the scheme.- Returns:
- the scheme null if undefined scheme
-
setRawAuthority
Deprecated.Set the authority. It can be one type of server, hostport, hostname, IPv4address, IPv6reference and reg_name.authority = server | reg_name
- Parameters:
escapedAuthority- the raw escaped authority- Throws:
URIException- IfparseAuthority(java.lang.String,boolean)failsNullPointerException- null authority
-
setEscapedAuthority
Deprecated.Set the authority. It can be one type of server, hostport, hostname, IPv4address, IPv6reference and reg_name. Note that there is no setAuthority method by the escape encoding reason.- Parameters:
escapedAuthority- the escaped authority string- Throws:
URIException- IfparseAuthority(java.lang.String,boolean)fails
-
getRawAuthority
public char[] getRawAuthority()Deprecated.Get the raw-escaped authority.- Returns:
- the raw-escaped authority
-
getEscapedAuthority
Deprecated.Get the escaped authority.- Returns:
- the escaped authority
-
getAuthority
Deprecated.Get the authority.- Returns:
- the authority
- Throws:
URIException- Ifdecode(char[], java.lang.String)fails
-
getRawUserinfo
public char[] getRawUserinfo()Deprecated.Get the raw-escaped userinfo.- Returns:
- the raw-escaped userinfo
- See Also:
-
getEscapedUserinfo
Deprecated.Get the escaped userinfo.- Returns:
- the escaped userinfo
- See Also:
-
getUserinfo
Deprecated.Get the userinfo.- Returns:
- the userinfo
- Throws:
URIException- Ifdecode(char[], java.lang.String)fails- See Also:
-
getRawHost
public char[] getRawHost()Deprecated.Get the host.host = hostname | IPv4address | IPv6reference
- Returns:
- the host
- See Also:
-
getHost
Deprecated.Get the host.host = hostname | IPv4address | IPv6reference
- Returns:
- the host
- Throws:
URIException- Ifdecode(char[], java.lang.String)fails- See Also:
-
getPort
public int getPort()Deprecated.Get the port. In order to get the specfic default port, the specific protocol-supported class extended from the URI class should be used. It has the server-based naming authority.- Returns:
- the port if -1, it has the default port for the scheme or the server-based naming authority is not supported in the specific URI.
-
setRawPath
Deprecated.Set the raw-escaped path.- Parameters:
escapedPath- the path character sequence- Throws:
URIException- encoding error or not proper for initial instance- See Also:
-
setEscapedPath
Deprecated.Set the escaped path.- Parameters:
escapedPath- the escaped path string- Throws:
URIException- encoding error or not proper for initial instance- See Also:
-
setPath
Deprecated.Set the path.- Parameters:
path- the path string- Throws:
URIException- set incorrectly or fragment only- See Also:
-
getRawCurrentHierPath
Deprecated.Get the raw-escaped current hierarchy level.- Returns:
- the raw-escaped current hierarchy level
- Throws:
URIException- IfgetRawCurrentHierPath(char[])fails.
-
getEscapedCurrentHierPath
Deprecated.Get the escaped current hierarchy level.- Returns:
- the escaped current hierarchy level
- Throws:
URIException- IfgetRawCurrentHierPath(char[])fails.
-
getCurrentHierPath
Deprecated.Get the current hierarchy level.- Returns:
- the current hierarchy level
- Throws:
URIException- IfgetRawCurrentHierPath(char[])fails.- See Also:
-
getRawAboveHierPath
Deprecated.Get the level above the this hierarchy level.- Returns:
- the raw above hierarchy level
- Throws:
URIException- IfgetRawCurrentHierPath(char[])fails.
-
getEscapedAboveHierPath
Deprecated.Get the level above the this hierarchy level.- Returns:
- the raw above hierarchy level
- Throws:
URIException- IfgetRawCurrentHierPath(char[])fails.
-
getAboveHierPath
Deprecated.Get the level above the this hierarchy level.- Returns:
- the above hierarchy level
- Throws:
URIException- IfgetRawCurrentHierPath(char[])fails.- See Also:
-
getRawPath
public char[] getRawPath()Deprecated.Get the raw-escaped path.path = [ abs_path | opaque_part ]
- Returns:
- the raw-escaped path
-
getEscapedPath
Deprecated.Get the escaped path.path = [ abs_path | opaque_part ] abs_path = "/" path_segments opaque_part = uric_no_slash *uric
- Returns:
- the escaped path string
-
getPath
Deprecated.Get the path.path = [ abs_path | opaque_part ]
- Returns:
- the path string
- Throws:
URIException- Ifdecode(char[], java.lang.String)fails.- See Also:
-
getRawName
public char[] getRawName()Deprecated.Get the raw-escaped basename of the path.- Returns:
- the raw-escaped basename
-
getEscapedName
Deprecated.Get the escaped basename of the path.- Returns:
- the escaped basename string
-
getName
Deprecated.Get the basename of the path.- Returns:
- the basename string
- Throws:
URIException- incomplete trailing escape pattern or unsupported character encoding- See Also:
-
getRawPathQuery
public char[] getRawPathQuery()Deprecated.Get the raw-escaped path and query.- Returns:
- the raw-escaped path and query
-
getEscapedPathQuery
Deprecated.Get the escaped query.- Returns:
- the escaped path and query string
-
getPathQuery
Deprecated.Get the path and query.- Returns:
- the path and query string.
- Throws:
URIException- incomplete trailing escape pattern or unsupported character encoding- See Also:
-
setRawQuery
Deprecated.Set the raw-escaped query.- Parameters:
escapedQuery- the raw-escaped query- Throws:
URIException- escaped query not valid
-
setEscapedQuery
Deprecated.Set the escaped query string.- Parameters:
escapedQuery- the escaped query string- Throws:
URIException- escaped query not valid
-
setQuery
Deprecated.Set the query.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.- Parameters:
query- the query string.- Throws:
URIException- incomplete trailing escape pattern or unsupported character encoding- See Also:
-
getRawQuery
public char[] getRawQuery()Deprecated.Get the raw-escaped query.- Returns:
- the raw-escaped query
-
getEscapedQuery
Deprecated.Get the escaped query.- Returns:
- the escaped query string
-
getQuery
Deprecated.Get the query.- Returns:
- the query string.
- Throws:
URIException- incomplete trailing escape pattern or unsupported character encoding- See Also:
-
setRawFragment
Deprecated.Set the raw-escaped fragment.- Parameters:
escapedFragment- the raw-escaped fragment- Throws:
URIException- escaped fragment not valid
-
setEscapedFragment
Deprecated.Set the escaped fragment string.- Parameters:
escapedFragment- the escaped fragment string- Throws:
URIException- escaped fragment not valid
-
setFragment
Deprecated.Set the fragment.- Parameters:
fragment- the fragment string.- Throws:
URIException- If an error occurs.
-
getRawFragment
public char[] getRawFragment()Deprecated.Get the raw-escaped fragment.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.
- Returns:
- the raw-escaped fragment
-
getEscapedFragment
Deprecated.Get the escaped fragment.- Returns:
- the escaped fragment string
-
getFragment
Deprecated.Get the fragment.- Returns:
- the fragment string
- Throws:
URIException- incomplete trailing escape pattern or unsupported character encoding- See Also:
-
normalize
Deprecated.Normalizes the path part of this URI. Normalization is only meant to be performed on URIs with an absolute path. Calling this method on a relative path URI will have no effect.- Throws:
URIException- no more higher path level to be normalized- See Also:
-
equals
Deprecated.Test an object if this URI is equal to another. -
hashCode
public int hashCode()Deprecated.Return a hash code for this URI. -
compareTo
Deprecated.Compare this URI to another object.- Specified by:
compareToin interfaceComparable- Parameters:
obj- the object to be compared.- Returns:
- 0, if it's same, -1, if failed, first being compared with in the authority component
- Throws:
ClassCastException- not URI argument
-
clone
Deprecated.Create and return a copy of this object, the URI-reference containing the userinfo component. Notice that the whole URI-reference including the userinfo component counld not be gotten as aString.To copy the identical
URIobject including the userinfo component, it should be used.- Returns:
- a clone of this instance
- Throws:
CloneNotSupportedException
-
getRawURI
public char[] getRawURI()Deprecated.It can be gotten the URI character sequence. It's raw-escaped. For the purpose of the protocol to be transported, it will be useful.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.
- Returns:
- the URI character sequence
-
getEscapedURI
Deprecated.It can be gotten the URI character sequence. It's escaped. For the purpose of the protocol to be transported, it will be useful.- Returns:
- the escaped URI string
-
getURI
Deprecated.It can be gotten the URI character sequence.- Returns:
- the original URI string
- Throws:
URIException- incomplete trailing escape pattern or unsupported character encoding- See Also:
-
getRawURIReference
public char[] getRawURIReference()Deprecated.Get the URI reference character sequence.- Returns:
- the URI reference character sequence
-
getEscapedURIReference
Deprecated.Get the escaped URI reference string.- Returns:
- the escaped URI reference string
-
getURIReference
Deprecated.Get the original URI reference string.- Returns:
- the original URI reference string
- Throws:
URIException- Ifdecode(char[], java.lang.String)fails.
-
toString
Deprecated.Get the escaped URI string.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.
-