Class URIUtils


  • public class URIUtils
    extends java.lang.Object
    The URI escape and character encoding and decoding utility.

    This was forked from some needed methods such as #encodePath(...) in org.apache.commons.httpclient.util.URIUtil, in order to not be dependent on HttpClient v3 API, when generating and handling GenericURLFileNames, but it should work with any different HTTP backend provider implementations.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  URIUtils.EncodingUtils
      Internal character encoding utilities.
      private static class  URIUtils.URLCodecUtils
      Internal URL codec utilities.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String DEFAULT_PROTOCOL_CHARSET
      The default charset of the protocol.
      private static org.apache.commons.logging.Log LOG  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private URIUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.lang.String encode​(java.lang.String unescaped, java.util.BitSet allowed, java.lang.String charset)  
      static java.lang.String encodePath​(java.lang.String unescaped)
      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)
      Escape and encode a string regarded as the path component of an URI with a given charset.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOG

        private static final org.apache.commons.logging.Log LOG
      • DEFAULT_PROTOCOL_CHARSET

        private static final java.lang.String DEFAULT_PROTOCOL_CHARSET
        The default charset of the protocol. RFC 2277, 2396
        See Also:
        Constant Field Values
    • Constructor Detail

      • URIUtils

        private URIUtils()
    • Method Detail

      • encode

        private static java.lang.String encode​(java.lang.String unescaped,
                                               java.util.BitSet allowed,
                                               java.lang.String charset)
      • encodePath

        public static java.lang.String encodePath​(java.lang.String unescaped)
        Escape and encode a string regarded as the path component of an URI with the default protocol charset.
        Parameters:
        unescaped - an unescaped string
        Returns:
        the escaped string
      • encodePath

        public static java.lang.String encodePath​(java.lang.String unescaped,
                                                  java.lang.String charset)
        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