Class URI

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Comparable
    Direct Known Subclasses:
    HttpURL

    @Deprecated
    public class URI
    extends java.lang.Object
    implements java.lang.Cloneable, java.lang.Comparable, java.io.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 = <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: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:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  URI.DefaultCharsetChanged
      Deprecated.
      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
      Deprecated.
      A mapping to determine the (somewhat arbitrarily) preferred charset for a given locale.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.BitSet allowed_abs_path
      Deprecated.
      Those characters that are allowed for the abs_path.
      static java.util.BitSet allowed_authority
      Deprecated.
      Those characters that are allowed for the authority component.
      static java.util.BitSet allowed_fragment
      Deprecated.
      Those characters that are allowed for the fragment component.
      static java.util.BitSet allowed_host
      Deprecated.
      Those characters that are allowed for the host component.
      static java.util.BitSet allowed_IPv6reference
      Deprecated.
      Those characters that are allowed for the IPv6reference component.
      static java.util.BitSet allowed_opaque_part
      Deprecated.
      Those characters that are allowed for the opaque_part.
      static java.util.BitSet allowed_query
      Deprecated.
      Those characters that are allowed for the query component.
      static java.util.BitSet allowed_reg_name
      Deprecated.
      Those characters that are allowed for the reg_name.
      static java.util.BitSet allowed_rel_path
      Deprecated.
      Those characters that are allowed for the rel_path.
      static java.util.BitSet allowed_userinfo
      Deprecated.
      Those characters that are allowed for the userinfo component.
      static java.util.BitSet allowed_within_authority
      Deprecated.
      Those characters that are allowed for the authority component.
      static java.util.BitSet allowed_within_path
      Deprecated.
      Those characters that are allowed within the path.
      static java.util.BitSet allowed_within_query
      Deprecated.
      Those characters that are allowed within the query component.
      static java.util.BitSet allowed_within_userinfo
      Deprecated.
      Those characters that are allowed for within the userinfo component.
      static java.util.BitSet control
      Deprecated.
      BitSet for control.
      static java.util.BitSet delims
      Deprecated.
      BitSet for delims.
      static java.util.BitSet disallowed_opaque_part
      Deprecated.
      Disallowed opaque_part before escaping.
      static java.util.BitSet disallowed_rel_path
      Deprecated.
      Disallowed rel_path before escaping.
      static java.util.BitSet space
      Deprecated.
      BitSet for space.
      static java.util.BitSet unwise
      Deprecated.
      BitSet for unwise.
      static java.util.BitSet within_userinfo
      Deprecated.
      BitSet for within the userinfo component like user and password.
    • Constructor Summary

      Constructors 
      Constructor Description
      URI​(char[] escaped)
      Deprecated.
      Use #URI(String, boolean)
      URI​(char[] escaped, java.lang.String charset)
      Deprecated.
      Use #URI(String, boolean, String)
      URI​(java.lang.String original)
      Deprecated.
      Use #URI(String, boolean)
      URI​(java.lang.String s, boolean escaped)
      Deprecated.
      Construct a URI from a string with the given charset.
      URI​(java.lang.String s, boolean escaped, java.lang.String charset)
      Deprecated.
      Construct a URI from a string with the given charset.
      URI​(java.lang.String original, java.lang.String charset)
      Deprecated.
      Use #URI(String, boolean, String)
      URI​(java.lang.String scheme, java.lang.String schemeSpecificPart, java.lang.String fragment)
      Deprecated.
      Construct a general URI from the given components.
      URI​(java.lang.String scheme, java.lang.String userinfo, java.lang.String host, int port)
      Deprecated.
      Construct a general URI from the given components.
      URI​(java.lang.String scheme, java.lang.String userinfo, java.lang.String host, int port, java.lang.String path)
      Deprecated.
      Construct a general URI from the given components.
      URI​(java.lang.String scheme, java.lang.String userinfo, java.lang.String host, int port, java.lang.String path, java.lang.String query)
      Deprecated.
      Construct a general URI from the given components.
      URI​(java.lang.String scheme, java.lang.String userinfo, java.lang.String host, int port, java.lang.String path, java.lang.String query, java.lang.String fragment)
      Deprecated.
      Construct a general URI from the given components.
      URI​(java.lang.String scheme, java.lang.String host, java.lang.String path, java.lang.String fragment)
      Deprecated.
      Construct a general URI from the given components.
      URI​(java.lang.String scheme, java.lang.String authority, java.lang.String path, java.lang.String query, java.lang.String fragment)
      Deprecated.
      Construct a general URI from the given components.
      URI​(URI base, java.lang.String relative)
      Deprecated.
      Use #URI(URI, String, boolean)
      URI​(URI base, java.lang.String relative, boolean escaped)
      Deprecated.
      Construct a general URI with the given relative URI string.
      URI​(URI base, URI relative)
      Deprecated.
      Construct a general URI with the given relative URI.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Deprecated.
      Create and return a copy of this object, the URI-reference containing the userinfo component.
      int compareTo​(java.lang.Object obj)
      Deprecated.
      Compare this URI to another object.
      boolean equals​(java.lang.Object obj)
      Deprecated.
      Test an object if this URI is equal to another.
      java.lang.String getAboveHierPath()
      Deprecated.
      Get the level above the this hierarchy level.
      java.lang.String getAuthority()
      Deprecated.
      Get the authority.
      java.lang.String getCurrentHierPath()
      Deprecated.
      Get the current hierarchy level.
      static java.lang.String getDefaultDocumentCharset()
      Deprecated.
      Get the recommended default charset of the document.
      static java.lang.String getDefaultDocumentCharsetByLocale()
      Deprecated.
      Get the default charset of the document by locale.
      static java.lang.String getDefaultDocumentCharsetByPlatform()
      Deprecated.
      Get the default charset of the document by platform.
      static java.lang.String getDefaultProtocolCharset()
      Deprecated.
      Get the default charset of the protocol.
      java.lang.String getEscapedAboveHierPath()
      Deprecated.
      Get the level above the this hierarchy level.
      java.lang.String getEscapedAuthority()
      Deprecated.
      Get the escaped authority.
      java.lang.String getEscapedCurrentHierPath()
      Deprecated.
      Get the escaped current hierarchy level.
      java.lang.String getEscapedFragment()
      Deprecated.
      Get the escaped fragment.
      java.lang.String getEscapedName()
      Deprecated.
      Get the escaped basename of the path.
      java.lang.String getEscapedPath()
      Deprecated.
      Get the escaped path.
      java.lang.String getEscapedPathQuery()
      Deprecated.
      Get the escaped query.
      java.lang.String getEscapedQuery()
      Deprecated.
      Get the escaped query.
      java.lang.String getEscapedURI()
      Deprecated.
      It can be gotten the URI character sequence.
      java.lang.String getEscapedURIReference()
      Deprecated.
      Get the escaped URI reference string.
      java.lang.String getEscapedUserinfo()
      Deprecated.
      Get the escaped userinfo.
      java.lang.String getFragment()
      Deprecated.
      Get the fragment.
      java.lang.String getHost()
      Deprecated.
      Get the host.
      java.lang.String getName()
      Deprecated.
      Get the basename of the path.
      java.lang.String getPath()
      Deprecated.
      Get the path.
      java.lang.String getPathQuery()
      Deprecated.
      Get the path and query.
      int getPort()
      Deprecated.
      Get the port.
      java.lang.String getProtocolCharset()
      Deprecated.
      Get the protocol charset used by this current URI instance.
      java.lang.String getQuery()
      Deprecated.
      Get the query.
      char[] getRawAboveHierPath()
      Deprecated.
      Get the level above the this hierarchy level.
      char[] getRawAuthority()
      Deprecated.
      Get the raw-escaped authority.
      char[] getRawCurrentHierPath()
      Deprecated.
      Get the raw-escaped current hierarchy level.
      char[] getRawFragment()
      Deprecated.
      Get the raw-escaped fragment.
      char[] getRawHost()
      Deprecated.
      Get the host.
      char[] getRawName()
      Deprecated.
      Get the raw-escaped basename of the path.
      char[] getRawPath()
      Deprecated.
      Get the raw-escaped path.
      char[] getRawPathQuery()
      Deprecated.
      Get the raw-escaped path and query.
      char[] getRawQuery()
      Deprecated.
      Get the raw-escaped query.
      char[] getRawScheme()
      Deprecated.
      Get the scheme.
      char[] getRawURI()
      Deprecated.
      It can be gotten the URI character sequence.
      char[] getRawURIReference()
      Deprecated.
      Get the URI reference character sequence.
      char[] getRawUserinfo()
      Deprecated.
      Get the raw-escaped userinfo.
      java.lang.String getScheme()
      Deprecated.
      Get the scheme.
      java.lang.String getURI()
      Deprecated.
      It can be gotten the URI character sequence.
      java.lang.String getURIReference()
      Deprecated.
      Get the original URI reference string.
      java.lang.String getUserinfo()
      Deprecated.
      Get the userinfo.
      boolean hasAuthority()
      Deprecated.
      Tell whether or not this URI has authority.
      boolean hasFragment()
      Deprecated.
      Tell whether or not this URI has fragment.
      int hashCode()
      Deprecated.
      Return a hash code for this URI.
      boolean hasQuery()
      Deprecated.
      Tell whether or not this URI has query.
      boolean hasUserinfo()
      Deprecated.
      Tell whether or not this URI has userinfo.
      boolean isAbsoluteURI()
      Deprecated.
      Tell whether or not this URI is absolute.
      boolean isAbsPath()
      Deprecated.
      Tell whether or not the relativeURI or hier_part of this URI is abs_path.
      boolean isHierPart()
      Deprecated.
      Tell whether or not the absoluteURI of this URI is hier_part.
      boolean isHostname()
      Deprecated.
      Tell whether or not the host part of this URI is hostname.
      boolean isIPv4address()
      Deprecated.
      Tell whether or not the host part of this URI is IPv4address.
      boolean isIPv6reference()
      Deprecated.
      Tell whether or not the host part of this URI is IPv6reference.
      boolean isNetPath()
      Deprecated.
      Tell whether or not the relativeURI or heir_part of this URI is net_path.
      boolean isOpaquePart()
      Deprecated.
      Tell whether or not the absoluteURI of this URI is opaque_part.
      boolean isRegName()
      Deprecated.
      Tell whether or not the authority component of this URI is reg_name.
      boolean isRelativeURI()
      Deprecated.
      Tell whether or not this URI is relative.
      boolean isRelPath()
      Deprecated.
      Tell whether or not the relativeURI of this URI is rel_path.
      boolean isServer()
      Deprecated.
      Tell whether or not the authority component of this URI is server.
      void normalize()
      Deprecated.
      Normalizes the path part of this URI.
      static void setDefaultDocumentCharset​(java.lang.String charset)
      Deprecated.
      Set the default charset of the document.
      static void setDefaultProtocolCharset​(java.lang.String charset)
      Deprecated.
      Set the default charset of the protocol.
      void setEscapedAuthority​(java.lang.String escapedAuthority)
      Deprecated.
      Set the authority.
      void setEscapedFragment​(java.lang.String escapedFragment)
      Deprecated.
      Set the escaped fragment string.
      void setEscapedPath​(java.lang.String escapedPath)
      Deprecated.
      Set the escaped path.
      void setEscapedQuery​(java.lang.String escapedQuery)
      Deprecated.
      Set the escaped query string.
      void setFragment​(java.lang.String fragment)
      Deprecated.
      Set the fragment.
      void setPath​(java.lang.String path)
      Deprecated.
      Set the path.
      void setQuery​(java.lang.String query)
      Deprecated.
      Set the query.
      void setRawAuthority​(char[] escapedAuthority)
      Deprecated.
      Set the authority.
      void setRawFragment​(char[] escapedFragment)
      Deprecated.
      Set the raw-escaped fragment.
      void setRawPath​(char[] escapedPath)
      Deprecated.
      Set the raw-escaped path.
      void setRawQuery​(char[] escapedQuery)
      Deprecated.
      Set the raw-escaped query.
      java.lang.String toString()
      Deprecated.
      Get the escaped URI string.
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • within_userinfo

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

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

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

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

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

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

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

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

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

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

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

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

        public static final java.util.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 java.util.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 java.util.BitSet allowed_within_authority
        Deprecated.
        Those characters that are allowed for the authority component.
      • allowed_abs_path

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

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

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

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

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

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

      • URI

        public URI​(java.lang.String s,
                   boolean escaped,
                   java.lang.String charset)
            throws URIException,
                   java.lang.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.
        java.lang.NullPointerException - if input string is null
        Since:
        3.0
        See Also:
        getProtocolCharset()
      • URI

        public URI​(java.lang.String s,
                   boolean escaped)
            throws URIException,
                   java.lang.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.
        java.lang.NullPointerException - if input string is null
        Since:
        3.0
        See Also:
        getProtocolCharset()
      • URI

        public URI​(char[] escaped,
                   java.lang.String charset)
            throws URIException,
                   java.lang.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.
        java.lang.NullPointerException - if escaped is null
        See Also:
        getProtocolCharset()
      • URI

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

        public URI​(java.lang.String original,
                   java.lang.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:
        getProtocolCharset()
      • URI

        public URI​(java.lang.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:
        getDefaultProtocolCharset()
      • URI

        public URI​(java.lang.String scheme,
                   java.lang.String schemeSpecificPart,
                   java.lang.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:
        getDefaultProtocolCharset()
      • URI

        public URI​(java.lang.String scheme,
                   java.lang.String authority,
                   java.lang.String path,
                   java.lang.String query,
                   java.lang.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:
        getDefaultProtocolCharset()
      • URI

        public URI​(java.lang.String scheme,
                   java.lang.String userinfo,
                   java.lang.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:
        getDefaultProtocolCharset()
      • URI

        public URI​(java.lang.String scheme,
                   java.lang.String userinfo,
                   java.lang.String host,
                   int port,
                   java.lang.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:
        getDefaultProtocolCharset()
      • URI

        public URI​(java.lang.String scheme,
                   java.lang.String userinfo,
                   java.lang.String host,
                   int port,
                   java.lang.String path,
                   java.lang.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:
        getDefaultProtocolCharset()
      • URI

        public URI​(java.lang.String scheme,
                   java.lang.String userinfo,
                   java.lang.String host,
                   int port,
                   java.lang.String path,
                   java.lang.String query,
                   java.lang.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:
        getDefaultProtocolCharset()
      • URI

        public URI​(java.lang.String scheme,
                   java.lang.String host,
                   java.lang.String path,
                   java.lang.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:
        getDefaultProtocolCharset()
      • URI

        public URI​(URI base,
                   java.lang.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,
                   java.lang.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 Detail

      • 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:
        hasAuthority()
      • 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:
        isNetPath()
      • 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​(java.lang.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 java.lang.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 java.lang.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:
        getDefaultProtocolCharset()
      • setDefaultDocumentCharset

        public static void setDefaultDocumentCharset​(java.lang.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 java.lang.String getDefaultDocumentCharset()
        Deprecated.
        Get the recommended default charset of the document.
        Returns:
        the default charset string
      • getDefaultDocumentCharsetByLocale

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

        public static java.lang.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 java.lang.String getScheme()
        Deprecated.
        Get the scheme.
        Returns:
        the scheme null if undefined scheme
      • setRawAuthority

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

        public void setEscapedAuthority​(java.lang.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 java.lang.String getEscapedAuthority()
        Deprecated.
        Get the escaped authority.
        Returns:
        the escaped authority
      • getRawUserinfo

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

        public java.lang.String getEscapedUserinfo()
        Deprecated.
        Get the escaped userinfo.
        Returns:
        the escaped userinfo
        See Also:
        getAuthority()
      • getRawHost

        public char[] getRawHost()
        Deprecated.
        Get the host.

           host          = hostname | IPv4address | IPv6reference
         

        Returns:
        the host
        See Also:
        getAuthority()
      • 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.
      • getRawPath

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

           path          = [ abs_path | opaque_part ]
         

        Returns:
        the raw-escaped path
      • getEscapedPath

        public java.lang.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
      • getRawName

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

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

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

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

        public java.lang.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​(java.lang.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​(java.lang.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 java.lang.String getEscapedQuery()
        Deprecated.
        Get the escaped query.
        Returns:
        the escaped query 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​(java.lang.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​(java.lang.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 java.lang.String getEscapedFragment()
        Deprecated.
        Get the escaped fragment.
        Returns:
        the escaped fragment 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:
        isAbsPath()
      • equals

        public boolean equals​(java.lang.Object obj)
        Deprecated.
        Test an object if this URI is equal to another.
        Overrides:
        equals in class java.lang.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 java.lang.Object
        Returns:
        a has code value for this URI
      • compareTo

        public int compareTo​(java.lang.Object obj)
                      throws java.lang.ClassCastException
        Deprecated.
        Compare this URI to another object.
        Specified by:
        compareTo in interface java.lang.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:
        java.lang.ClassCastException - not URI argument
      • clone

        public java.lang.Object clone()
                               throws java.lang.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:
        java.lang.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 java.lang.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 java.lang.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 java.lang.String getEscapedURIReference()
        Deprecated.
        Get the escaped URI reference string.
        Returns:
        the escaped URI reference string
      • toString

        public java.lang.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 java.lang.Object
        Returns:
        the escaped URI string
        See Also:
        clone()