Class URIUtil


  • @Deprecated
    public class URIUtil
    extends java.lang.Object
    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 URI escape and character encoding and decoding utility. It's compatible with HttpURL rather than URI.
    • Constructor Summary

      Constructors 
      Constructor Description
      URIUtil()
      Deprecated.
       
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static java.lang.String decode​(java.lang.String escaped)
      Deprecated.
      Unescape and decode a given string regarded as an escaped string with the default protocol charset.
      static java.lang.String decode​(java.lang.String escaped, java.lang.String charset)
      Deprecated.
      Unescape and decode a given string regarded as an escaped string.
      static java.lang.String encode​(java.lang.String unescaped, java.util.BitSet allowed)
      Deprecated.
      Escape and encode a given string with allowed characters not to be escaped and the default protocol charset.
      static java.lang.String encode​(java.lang.String unescaped, java.util.BitSet allowed, java.lang.String charset)
      Deprecated.
      Escape and encode a given string with allowed characters not to be escaped and a given charset.
      static java.lang.String encodeAll​(java.lang.String unescaped)
      Deprecated.
      Get the all escaped and encoded string with the default protocl charset.
      static java.lang.String encodeAll​(java.lang.String unescaped, java.lang.String charset)
      Deprecated.
      Get the all escaped and encoded string with a given charset.
      static java.lang.String encodePath​(java.lang.String unescaped)
      Deprecated.
      Escape and encode a string regarded as the path component of an URI with the default protocol charset.
      static java.lang.String encodePath​(java.lang.String unescaped, java.lang.String charset)
      Deprecated.
      Escape and encode a string regarded as the path component of an URI with a given charset.
      static java.lang.String encodePathQuery​(java.lang.String unescaped)
      Deprecated.
      Escape and encode a string regarded as the path and query components of an URI with the default protocol charset.
      static java.lang.String encodePathQuery​(java.lang.String unescaped, java.lang.String charset)
      Deprecated.
      Escape and encode a string regarded as the path and query components of an URI with a given charset.
      static java.lang.String encodeQuery​(java.lang.String unescaped)
      Deprecated.
      Escape and encode a string regarded as the query component of an URI with the default protocol charset.
      static java.lang.String encodeQuery​(java.lang.String unescaped, java.lang.String charset)
      Deprecated.
      Escape and encode a string regarded as the query component of an URI with a given charset.
      static java.lang.String encodeWithinAuthority​(java.lang.String unescaped)
      Deprecated.
      Escape and encode a string regarded as within the authority component of an URI with the default protocol charset.
      static java.lang.String encodeWithinAuthority​(java.lang.String unescaped, java.lang.String charset)
      Deprecated.
      Escape and encode a string regarded as within the authority component of an URI with a given charset.
      static java.lang.String encodeWithinPath​(java.lang.String unescaped)
      Deprecated.
      Escape and encode a string regarded as within the path component of an URI with the default protocol charset.
      static java.lang.String encodeWithinPath​(java.lang.String unescaped, java.lang.String charset)
      Deprecated.
      Escape and encode a string regarded as within the path component of an URI with a given charset.
      static java.lang.String encodeWithinQuery​(java.lang.String unescaped)
      Deprecated.
      Escape and encode a string regarded as within the query component of an URI with the default protocol charset.
      static java.lang.String encodeWithinQuery​(java.lang.String unescaped, java.lang.String charset)
      Deprecated.
      Escape and encode a string regarded as within the query component of an URI with a given charset.
      static java.lang.String getFromPath​(java.lang.String uri)
      Deprecated.
      Get the path of an URI and its rest part.
      static java.lang.String getName​(java.lang.String uri)
      Deprecated.
      Get the basename of an URI.
      static java.lang.String getPath​(java.lang.String uri)
      Deprecated.
      Get the path of an URI.
      static java.lang.String getPathQuery​(java.lang.String uri)
      Deprecated.
      Get the path and query of an URI.
      static java.lang.String getQuery​(java.lang.String uri)
      Deprecated.
      Get the query of an URI.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • URIUtil

        public URIUtil()
        Deprecated.
    • Method Detail

      • getName

        public static java.lang.String getName​(java.lang.String uri)
        Deprecated.
        Get the basename of an URI. It's possibly an empty string.
        Parameters:
        uri - a string regarded an URI
        Returns:
        the basename string; an empty string if the path ends with slash
      • getQuery

        public static java.lang.String getQuery​(java.lang.String uri)
        Deprecated.
        Get the query of an URI.
        Parameters:
        uri - a string regarded an URI
        Returns:
        the query string; null if empty or undefined
      • getPath

        public static java.lang.String getPath​(java.lang.String uri)
        Deprecated.
        Get the path of an URI.
        Parameters:
        uri - a string regarded an URI
        Returns:
        the path string
      • getPathQuery

        public static java.lang.String getPathQuery​(java.lang.String uri)
        Deprecated.
        Get the path and query of an URI.
        Parameters:
        uri - a string regarded an URI
        Returns:
        the path and query string
      • getFromPath

        public static java.lang.String getFromPath​(java.lang.String uri)
        Deprecated.
        Get the path of an URI and its rest part.
        Parameters:
        uri - a string regarded an URI
        Returns:
        the string from the path part
      • encodeAll

        public static java.lang.String encodeAll​(java.lang.String unescaped)
                                          throws URIException
        Deprecated.
        Get the all escaped and encoded string with the default protocl charset. It's the same function to use encode(String unescaped, Bitset empty, URI.getDefaultProtocolCharset()).
        Parameters:
        unescaped - an unescaped string
        Returns:
        the escaped string
        Throws:
        URIException - if the default protocol charset is not supported
        See Also:
        URI.getDefaultProtocolCharset(), encode(java.lang.String, java.util.BitSet)
      • encodeAll

        public static java.lang.String encodeAll​(java.lang.String unescaped,
                                                 java.lang.String charset)
                                          throws URIException
        Deprecated.
        Get the all escaped and encoded string with a given charset. It's the same function to use encode(String unescaped, Bitset empty, String charset).
        Parameters:
        unescaped - an unescaped string
        charset - the charset
        Returns:
        the escaped string
        Throws:
        URIException - if the charset is not supported
        See Also:
        encode(java.lang.String, java.util.BitSet)
      • encodeWithinAuthority

        public static java.lang.String encodeWithinAuthority​(java.lang.String unescaped)
                                                      throws URIException
        Deprecated.
        Escape and encode a string regarded as within the authority component of an URI with the default protocol charset. Within the authority component, the characters ";", ":", "@", "?", and "/" are reserved.
        Parameters:
        unescaped - an unescaped string
        Returns:
        the escaped string
        Throws:
        URIException - if the default protocol charset is not supported
        See Also:
        URI.getDefaultProtocolCharset(), encode(java.lang.String, java.util.BitSet)
      • encodeWithinAuthority

        public static java.lang.String encodeWithinAuthority​(java.lang.String unescaped,
                                                             java.lang.String charset)
                                                      throws URIException
        Deprecated.
        Escape and encode a string regarded as within the authority component of an URI with a given charset. Within the authority component, the characters ";", ":", "@", "?", and "/" are reserved.
        Parameters:
        unescaped - an unescaped string
        charset - the charset
        Returns:
        the escaped string
        Throws:
        URIException - if the charset is not supported
        See Also:
        encode(java.lang.String, java.util.BitSet)
      • encodePathQuery

        public static java.lang.String encodePathQuery​(java.lang.String unescaped,
                                                       java.lang.String charset)
                                                throws URIException
        Deprecated.
        Escape and encode a string regarded as the path and query components of an URI with a given charset.
        Parameters:
        unescaped - an unescaped string
        charset - the charset
        Returns:
        the escaped string
        Throws:
        URIException - if the charset is not supported
        See Also:
        encode(java.lang.String, java.util.BitSet)
      • encodeWithinPath

        public static java.lang.String encodeWithinPath​(java.lang.String unescaped)
                                                 throws URIException
        Deprecated.
        Escape and encode a string regarded as within the path component of an URI with the default protocol charset. The path may consist of a sequence of path segments separated by a single slash "/" character. Within a path segment, the characters "/", ";", "=", and "?" are reserved.
        Parameters:
        unescaped - an unescaped string
        Returns:
        the escaped string
        Throws:
        URIException - if the default protocol charset is not supported
        See Also:
        URI.getDefaultProtocolCharset(), encode(java.lang.String, java.util.BitSet)
      • encodeWithinPath

        public static java.lang.String encodeWithinPath​(java.lang.String unescaped,
                                                        java.lang.String charset)
                                                 throws URIException
        Deprecated.
        Escape and encode a string regarded as within the path component of an URI with a given charset. The path may consist of a sequence of path segments separated by a single slash "/" character. Within a path segment, the characters "/", ";", "=", and "?" are reserved.
        Parameters:
        unescaped - an unescaped string
        charset - the charset
        Returns:
        the escaped string
        Throws:
        URIException - if the charset is not supported
        See Also:
        encode(java.lang.String, java.util.BitSet)
      • encodePath

        public static java.lang.String encodePath​(java.lang.String unescaped,
                                                  java.lang.String charset)
                                           throws URIException
        Deprecated.
        Escape and encode a string regarded as the path component of an URI with a given charset.
        Parameters:
        unescaped - an unescaped string
        charset - the charset
        Returns:
        the escaped string
        Throws:
        URIException - if the charset is not supported
        See Also:
        encode(java.lang.String, java.util.BitSet)
      • encodeWithinQuery

        public static java.lang.String encodeWithinQuery​(java.lang.String unescaped)
                                                  throws URIException
        Deprecated.
        Escape and encode a string regarded as within the query component of an URI with the default protocol charset. When a query comprise the name and value pairs, it is used in order to encode each name and value string. The reserved special characters within a query component are being included in encoding the query.
        Parameters:
        unescaped - an unescaped string
        Returns:
        the escaped string
        Throws:
        URIException - if the default protocol charset is not supported
        See Also:
        URI.getDefaultProtocolCharset(), encode(java.lang.String, java.util.BitSet)
      • encodeWithinQuery

        public static java.lang.String encodeWithinQuery​(java.lang.String unescaped,
                                                         java.lang.String charset)
                                                  throws URIException
        Deprecated.
        Escape and encode a string regarded as within the query component of an URI with a given charset. When a query comprise the name and value pairs, it is used in order to encode each name and value string. The reserved special characters within a query component are being included in encoding the query.
        Parameters:
        unescaped - an unescaped string
        charset - the charset
        Returns:
        the escaped string
        Throws:
        URIException - if the charset is not supported
        See Also:
        encode(java.lang.String, java.util.BitSet)
      • encodeQuery

        public static java.lang.String encodeQuery​(java.lang.String unescaped)
                                            throws URIException
        Deprecated.
        Escape and encode a string regarded as the query component of an URI with the default protocol charset. When a query string is not misunderstood the reserved special characters ("&", "=", "+", ",", and "$") within a query component, this method is recommended to use in encoding the whole query.
        Parameters:
        unescaped - an unescaped string
        Returns:
        the escaped string
        Throws:
        URIException - if the default protocol charset is not supported
        See Also:
        URI.getDefaultProtocolCharset(), encode(java.lang.String, java.util.BitSet)
      • encodeQuery

        public static java.lang.String encodeQuery​(java.lang.String unescaped,
                                                   java.lang.String charset)
                                            throws URIException
        Deprecated.
        Escape and encode a string regarded as the query component of an URI with a given charset. When a query string is not misunderstood the reserved special characters ("&", "=", "+", ",", and "$") within a query component, this method is recommended to use in encoding the whole query.
        Parameters:
        unescaped - an unescaped string
        charset - the charset
        Returns:
        the escaped string
        Throws:
        URIException - if the charset is not supported
        See Also:
        encode(java.lang.String, java.util.BitSet)
      • encode

        public static java.lang.String encode​(java.lang.String unescaped,
                                              java.util.BitSet allowed)
                                       throws URIException
        Deprecated.
        Escape and encode a given string with allowed characters not to be escaped and the default protocol charset.
        Parameters:
        unescaped - a string
        allowed - allowed characters not to be escaped
        Returns:
        the escaped string
        Throws:
        URIException - if the default protocol charset is not supported
        See Also:
        URI.getDefaultProtocolCharset()
      • encode

        public static java.lang.String encode​(java.lang.String unescaped,
                                              java.util.BitSet allowed,
                                              java.lang.String charset)
                                       throws URIException
        Deprecated.
        Escape and encode a given string with allowed characters not to be escaped and a given charset.
        Parameters:
        unescaped - a string
        allowed - allowed characters not to be escaped
        charset - the charset
        Returns:
        the escaped string
        Throws:
        URIException
      • decode

        public static java.lang.String decode​(java.lang.String escaped)
                                       throws URIException
        Deprecated.
        Unescape and decode a given string regarded as an escaped string with the default protocol charset.
        Parameters:
        escaped - a string
        Returns:
        the unescaped string
        Throws:
        URIException - if the string cannot be decoded (invalid)
        See Also:
        URI.getDefaultProtocolCharset()
      • decode

        public static java.lang.String decode​(java.lang.String escaped,
                                              java.lang.String charset)
                                       throws URIException
        Deprecated.
        Unescape and decode a given string regarded as an escaped string.
        Parameters:
        escaped - a string
        charset - the charset
        Returns:
        the unescaped string
        Throws:
        URIException - if the charset is not supported
        See Also:
        URIUtil.Coder.decode(char[], java.lang.String)