Class URI

java.lang.Object
org.apache.commons.httpclient.URI
All Implemented Interfaces:
Serializable, Cloneable, Comparable
Direct Known Subclasses:
HttpURL

@Deprecated public class URI extends Object implements Cloneable, Comparable, Serializable
Deprecated.
Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project. It is not recommended to use it in any new code. Instead, use HTTP client API plugins as a dependency in your code. E.g. Apache HttpComponents Client API 4.x Plugin or Async HTTP Client Plugin.
The interface for the URI(Uniform Resource Identifiers) version of RFC 2396. This class has the purpose of supportting of parsing a URI reference to extend any specific protocols, the character encoding of the protocol to be transported and the charset of the document.

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: '&gt':<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() // method
 

For unescaped URI forms - URI(String) // constructor - String getXXX() // method

See Also:
  • Field Details

    • within_userinfo

      public static final BitSet within_userinfo
      Deprecated.
      BitSet for within the userinfo component like user and password.
    • control

      public static final BitSet control
      Deprecated.
      BitSet for control.
    • space

      public static final BitSet space
      Deprecated.
      BitSet for space.
    • delims

      public static final BitSet delims
      Deprecated.
      BitSet for delims.
    • unwise

      public static final BitSet unwise
      Deprecated.
      BitSet for unwise.
    • disallowed_rel_path

      public static final BitSet disallowed_rel_path
      Deprecated.
      Disallowed rel_path before escaping.
    • disallowed_opaque_part

      public static final BitSet disallowed_opaque_part
      Deprecated.
      Disallowed opaque_part before escaping.
    • allowed_authority

      public static final BitSet allowed_authority
      Deprecated.
      Those characters that are allowed for the authority component.
    • allowed_opaque_part

      public static final BitSet allowed_opaque_part
      Deprecated.
      Those characters that are allowed for the opaque_part.
    • allowed_reg_name

      public static final BitSet allowed_reg_name
      Deprecated.
      Those characters that are allowed for the reg_name.
    • allowed_userinfo

      public static final BitSet allowed_userinfo
      Deprecated.
      Those characters that are allowed for the userinfo component.
    • allowed_within_userinfo

      public static final BitSet allowed_within_userinfo
      Deprecated.
      Those characters that are allowed for within the userinfo component.
    • allowed_IPv6reference

      public static final BitSet allowed_IPv6reference
      Deprecated.
      Those characters that are allowed for the IPv6reference component. The characters '[', ']' in IPv6reference should be excluded.
    • allowed_host

      public static final BitSet allowed_host
      Deprecated.
      Those characters that are allowed for the host component. The characters '[', ']' in IPv6reference should be excluded.
    • allowed_within_authority

      public static final BitSet allowed_within_authority
      Deprecated.
      Those characters that are allowed for the authority component.
    • allowed_abs_path

      public static final BitSet allowed_abs_path
      Deprecated.
      Those characters that are allowed for the abs_path.
    • allowed_rel_path

      public static final BitSet allowed_rel_path
      Deprecated.
      Those characters that are allowed for the rel_path.
    • allowed_within_path

      public static final BitSet allowed_within_path
      Deprecated.
      Those characters that are allowed within the path.
    • allowed_query

      public static final BitSet allowed_query
      Deprecated.
      Those characters that are allowed for the query component.
    • allowed_within_query

      public static final BitSet allowed_within_query
      Deprecated.
      Those characters that are allowed within the query component.
    • allowed_fragment

      public static final BitSet allowed_fragment
      Deprecated.
      Those characters that are allowed for the fragment component.
  • Constructor Details

    • URI

      public URI(String s, boolean escaped, String charset) throws URIException, NullPointerException
      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 sequence
      escaped - 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 is null
      Since:
      3.0
      See Also:
    • URI

      public URI(String s, boolean escaped) throws URIException, NullPointerException
      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 sequence
      escaped - true if URI character sequence is in escaped form. false otherwise.
      Throws:
      URIException - If the URI cannot be created.
      NullPointerException - if input string is null
      Since:
      3.0
      See Also:
    • URI

      public URI(char[] escaped, String charset) throws URIException, NullPointerException
      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 sequence
      charset - the charset string to do escape encoding
      Throws:
      URIException - If the URI cannot be created.
      NullPointerException - if escaped is null
      See Also:
    • URI

      public URI(char[] escaped) throws URIException, NullPointerException
      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 - if escaped is null
      See Also:
    • URI

      public URI(String original, String charset) throws URIException
      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

      public URI(String original) throws URIException
      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

      public URI(String scheme, String schemeSpecificPart, String fragment) throws URIException
      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 string
      schemeSpecificPart - scheme_specific_part
      fragment - 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 string
      authority - the authority string
      path - the path string
      query - the query string
      fragment - the fragment string
      Throws:
      URIException - If the new URI cannot be created.
      See Also:
    • URI

      public URI(String scheme, String userinfo, String host, int port) throws URIException
      Deprecated.
      Construct a general URI from the given components.
      Parameters:
      scheme - the scheme string
      userinfo - the userinfo string
      host - the host string
      port - the port number
      Throws:
      URIException - If the new URI cannot be created.
      See Also:
    • URI

      public URI(String scheme, String userinfo, String host, int port, String path) throws URIException
      Deprecated.
      Construct a general URI from the given components.
      Parameters:
      scheme - the scheme string
      userinfo - the userinfo string
      host - the host string
      port - the port number
      path - 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 string
      userinfo - the userinfo string
      host - the host string
      port - the port number
      path - the path string
      query - 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 string
      userinfo - the userinfo string
      host - the host string
      port - the port number
      path - the path string
      query - the query string
      fragment - the fragment string
      Throws:
      URIException - If the new URI cannot be created.
      See Also:
    • URI

      public URI(String scheme, String host, String path, String fragment) throws URIException
      Deprecated.
      Construct a general URI from the given components.
      Parameters:
      scheme - the scheme string
      host - the host string
      path - the path string
      fragment - the fragment string
      Throws:
      URIException - If the new URI cannot be created.
      See Also:
    • URI

      public URI(URI base, String relative) throws URIException
      Deprecated.
      Use #URI(URI, String, boolean)
      Construct a general URI with the given relative URI string.
      Parameters:
      base - the base URI
      relative - the relative URI string
      Throws:
      URIException - If the new URI cannot be created.
    • URI

      public URI(URI base, String relative, boolean escaped) throws URIException
      Deprecated.
      Construct a general URI with the given relative URI string.
      Parameters:
      base - the base URI
      relative - the relative URI string
      escaped - true if URI character sequence is in escaped form. false otherwise.
      Throws:
      URIException - If the new URI cannot be created.
      Since:
      3.0
    • URI

      public URI(URI base, URI relative) throws URIException
      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 URI
      relative - 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

      public static void setDefaultProtocolCharset(String charset) throws URI.DefaultCharsetChanged
      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 DefaultCharsetChanged exception. So API programmer must follow the following way:

        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
            }
        }
        
      The API programmer is responsible to set the correct charset. And each application should remember its own charset to support.
      Parameters:
      charset - the default charset for each protocol
      Throws:
      URI.DefaultCharsetChanged - default charset changed
    • getDefaultProtocolCharset

      public static String 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

      public 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

      public static void setDefaultDocumentCharset(String charset) throws URI.DefaultCharsetChanged
      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 DefaultCharsetChanged exception. So API programmer must follow the following way:

        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
            }
        }
        
      The API programmer is responsible to set the correct charset. And each application should remember its own charset to support.
      Parameters:
      charset - the default charset for the document
      Throws:
      URI.DefaultCharsetChanged - default charset changed
    • getDefaultDocumentCharset

      public static String getDefaultDocumentCharset()
      Deprecated.
      Get the recommended default charset of the document.
      Returns:
      the default charset string
    • getDefaultDocumentCharsetByLocale

      public static String getDefaultDocumentCharsetByLocale()
      Deprecated.
      Get the default charset of the document by locale.
      Returns:
      the default charset string by locale
    • getDefaultDocumentCharsetByPlatform

      public static String 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

      public String getScheme()
      Deprecated.
      Get the scheme.
      Returns:
      the scheme null if undefined scheme
    • setRawAuthority

      public void setRawAuthority(char[] escapedAuthority) throws URIException, NullPointerException
      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 - If parseAuthority(java.lang.String,boolean) fails
      NullPointerException - null authority
    • setEscapedAuthority

      public void setEscapedAuthority(String escapedAuthority) throws URIException
      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 - If parseAuthority(java.lang.String,boolean) fails
    • getRawAuthority

      public char[] getRawAuthority()
      Deprecated.
      Get the raw-escaped authority.
      Returns:
      the raw-escaped authority
    • getEscapedAuthority

      public String getEscapedAuthority()
      Deprecated.
      Get the escaped authority.
      Returns:
      the escaped authority
    • getAuthority

      public String getAuthority() throws URIException
      Deprecated.
      Get the authority.
      Returns:
      the authority
      Throws:
      URIException - If decode(char[], java.lang.String) fails
    • getRawUserinfo

      public char[] getRawUserinfo()
      Deprecated.
      Get the raw-escaped userinfo.
      Returns:
      the raw-escaped userinfo
      See Also:
    • getEscapedUserinfo

      public String getEscapedUserinfo()
      Deprecated.
      Get the escaped userinfo.
      Returns:
      the escaped userinfo
      See Also:
    • getUserinfo

      public String getUserinfo() throws URIException
      Deprecated.
      Get the userinfo.
      Returns:
      the userinfo
      Throws:
      URIException - If decode(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

      public String getHost() throws URIException
      Deprecated.
      Get the host.

         host          = hostname | IPv4address | IPv6reference
       

      Returns:
      the host
      Throws:
      URIException - If decode(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

      public void setRawPath(char[] escapedPath) throws URIException
      Deprecated.
      Set the raw-escaped path.
      Parameters:
      escapedPath - the path character sequence
      Throws:
      URIException - encoding error or not proper for initial instance
      See Also:
      • encode(java.lang.String, java.util.BitSet, java.lang.String)
    • setEscapedPath

      public void setEscapedPath(String escapedPath) throws URIException
      Deprecated.
      Set the escaped path.
      Parameters:
      escapedPath - the escaped path string
      Throws:
      URIException - encoding error or not proper for initial instance
      See Also:
      • encode(java.lang.String, java.util.BitSet, java.lang.String)
    • setPath

      public void setPath(String path) throws URIException
      Deprecated.
      Set the path.
      Parameters:
      path - the path string
      Throws:
      URIException - set incorrectly or fragment only
      See Also:
      • encode(java.lang.String, java.util.BitSet, java.lang.String)
    • getRawCurrentHierPath

      public char[] getRawCurrentHierPath() throws URIException
      Deprecated.
      Get the raw-escaped current hierarchy level.
      Returns:
      the raw-escaped current hierarchy level
      Throws:
      URIException - If getRawCurrentHierPath(char[]) fails.
    • getEscapedCurrentHierPath

      public String getEscapedCurrentHierPath() throws URIException
      Deprecated.
      Get the escaped current hierarchy level.
      Returns:
      the escaped current hierarchy level
      Throws:
      URIException - If getRawCurrentHierPath(char[]) fails.
    • getCurrentHierPath

      public String getCurrentHierPath() throws URIException
      Deprecated.
      Get the current hierarchy level.
      Returns:
      the current hierarchy level
      Throws:
      URIException - If getRawCurrentHierPath(char[]) fails.
      See Also:
      • decode(char[], java.lang.String)
    • getRawAboveHierPath

      public char[] getRawAboveHierPath() throws URIException
      Deprecated.
      Get the level above the this hierarchy level.
      Returns:
      the raw above hierarchy level
      Throws:
      URIException - If getRawCurrentHierPath(char[]) fails.
    • getEscapedAboveHierPath

      public String getEscapedAboveHierPath() throws URIException
      Deprecated.
      Get the level above the this hierarchy level.
      Returns:
      the raw above hierarchy level
      Throws:
      URIException - If getRawCurrentHierPath(char[]) fails.
    • getAboveHierPath

      public String getAboveHierPath() throws URIException
      Deprecated.
      Get the level above the this hierarchy level.
      Returns:
      the above hierarchy level
      Throws:
      URIException - If getRawCurrentHierPath(char[]) fails.
      See Also:
      • decode(char[], java.lang.String)
    • getRawPath

      public char[] getRawPath()
      Deprecated.
      Get the raw-escaped path.

         path          = [ abs_path | opaque_part ]
       

      Returns:
      the raw-escaped path
    • getEscapedPath

      public String 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

      public String getPath() throws URIException
      Deprecated.
      Get the path.

         path          = [ abs_path | opaque_part ]
       

      Returns:
      the path string
      Throws:
      URIException - If decode(char[], java.lang.String) fails.
      See Also:
      • decode(char[], java.lang.String)
    • getRawName

      public char[] getRawName()
      Deprecated.
      Get the raw-escaped basename of the path.
      Returns:
      the raw-escaped basename
    • getEscapedName

      public String getEscapedName()
      Deprecated.
      Get the escaped basename of the path.
      Returns:
      the escaped basename string
    • getName

      public String getName() throws URIException
      Deprecated.
      Get the basename of the path.
      Returns:
      the basename string
      Throws:
      URIException - incomplete trailing escape pattern or unsupported character encoding
      See Also:
      • decode(char[], java.lang.String)
    • getRawPathQuery

      public char[] getRawPathQuery()
      Deprecated.
      Get the raw-escaped path and query.
      Returns:
      the raw-escaped path and query
    • getEscapedPathQuery

      public String getEscapedPathQuery()
      Deprecated.
      Get the escaped query.
      Returns:
      the escaped path and query string
    • getPathQuery

      public String getPathQuery() throws URIException
      Deprecated.
      Get the path and query.
      Returns:
      the path and query string.
      Throws:
      URIException - incomplete trailing escape pattern or unsupported character encoding
      See Also:
      • decode(char[], java.lang.String)
    • setRawQuery

      public void setRawQuery(char[] escapedQuery) throws URIException
      Deprecated.
      Set the raw-escaped query.
      Parameters:
      escapedQuery - the raw-escaped query
      Throws:
      URIException - escaped query not valid
    • setEscapedQuery

      public void setEscapedQuery(String escapedQuery) throws URIException
      Deprecated.
      Set the escaped query string.
      Parameters:
      escapedQuery - the escaped query string
      Throws:
      URIException - escaped query not valid
    • setQuery

      public void setQuery(String query) throws URIException
      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:
      • encode(java.lang.String, java.util.BitSet, java.lang.String)
    • getRawQuery

      public char[] getRawQuery()
      Deprecated.
      Get the raw-escaped query.
      Returns:
      the raw-escaped query
    • getEscapedQuery

      public String getEscapedQuery()
      Deprecated.
      Get the escaped query.
      Returns:
      the escaped query string
    • getQuery

      public String getQuery() throws URIException
      Deprecated.
      Get the query.
      Returns:
      the query string.
      Throws:
      URIException - incomplete trailing escape pattern or unsupported character encoding
      See Also:
      • decode(char[], java.lang.String)
    • setRawFragment

      public void setRawFragment(char[] escapedFragment) throws URIException
      Deprecated.
      Set the raw-escaped fragment.
      Parameters:
      escapedFragment - the raw-escaped fragment
      Throws:
      URIException - escaped fragment not valid
    • setEscapedFragment

      public void setEscapedFragment(String escapedFragment) throws URIException
      Deprecated.
      Set the escaped fragment string.
      Parameters:
      escapedFragment - the escaped fragment string
      Throws:
      URIException - escaped fragment not valid
    • setFragment

      public void setFragment(String fragment) throws URIException
      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

      public String getEscapedFragment()
      Deprecated.
      Get the escaped fragment.
      Returns:
      the escaped fragment string
    • getFragment

      public String getFragment() throws URIException
      Deprecated.
      Get the fragment.
      Returns:
      the fragment string
      Throws:
      URIException - incomplete trailing escape pattern or unsupported character encoding
      See Also:
      • decode(char[], java.lang.String)
    • normalize

      public void normalize() throws URIException
      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

      public boolean equals(Object obj)
      Deprecated.
      Test an object if this URI is equal to another.
      Overrides:
      equals in class Object
      Parameters:
      obj - an object to compare
      Returns:
      true if two URI objects are equal
    • hashCode

      public int hashCode()
      Deprecated.
      Return a hash code for this URI.
      Overrides:
      hashCode in class Object
      Returns:
      a has code value for this URI
    • compareTo

      public int compareTo(Object obj) throws ClassCastException
      Deprecated.
      Compare this URI to another object.
      Specified by:
      compareTo in interface Comparable
      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

      public Object clone() throws CloneNotSupportedException
      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 a String.

      To copy the identical URI object 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

      public String 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

      public String getURI() throws URIException
      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:
      • decode(char[], java.lang.String)
    • getRawURIReference

      public char[] getRawURIReference()
      Deprecated.
      Get the URI reference character sequence.
      Returns:
      the URI reference character sequence
    • getEscapedURIReference

      public String getEscapedURIReference()
      Deprecated.
      Get the escaped URI reference string.
      Returns:
      the escaped URI reference string
    • getURIReference

      public String getURIReference() throws URIException
      Deprecated.
      Get the original URI reference string.
      Returns:
      the original URI reference string
      Throws:
      URIException - If decode(char[], java.lang.String) fails.
    • toString

      public String 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.

      Overrides:
      toString in class Object
      Returns:
      the escaped URI string
      See Also: