Class HTTPUtil


  • public abstract class HTTPUtil
    extends Object
    • Constructor Detail

      • HTTPUtil

        public HTTPUtil()
    • Method Detail

      • parseToURI

        public static URI parseToURI​(String u)
                              throws URISyntaxException
        Convert a uri string to an instance of java.net.URI. The critical thing is that this procedure can handle backslash escaped uris as well as %xx escaped uris.
        Parameters:
        u - the uri to convert
        Returns:
        The URI corresponding to u.
        Throws:
        URISyntaxException
      • merge

        protected static Map<ucar.httpservices.HTTPSession.Prop,​Object> merge​(Map<ucar.httpservices.HTTPSession.Prop,​Object> globalsettings,
                                                                                    Map<ucar.httpservices.HTTPSession.Prop,​Object> localsettings)
      • nullify

        public static String nullify​(String s)
        Convert a zero-length string to null
        Parameters:
        s - the string to check for length
        Returns:
        null if s.length() == 0, s otherwise
      • canonjoin

        public static String canonjoin​(String prefix,
                                       String suffix)
        Join two string together to form proper path WITHOUT trailing slash
      • canonicalpath

        public static String canonicalpath​(String path)
        Convert path to use '/' consistently and to remove any trailing '/'
        Parameters:
        path - convert this path
        Returns:
        canonicalized version
      • canonicalpath

        public static void canonicalpath​(StringBuilder s)
      • relpath

        public static String relpath​(String path)
        Convert path to remove any leading '/' or drive letter assumes canonical.
        Parameters:
        path - convert this path
        Returns:
        relatived version
      • hasDriveLetter

        public static boolean hasDriveLetter​(String path)
        Parameters:
        path - to test
        Returns:
        true if path appears to start with Windows drive letter
      • hasDriveLetter

        protected static boolean hasDriveLetter​(StringBuilder path)
      • isAbsolutePath

        public static boolean isAbsolutePath​(String path)
        Parameters:
        path - to test
        Returns:
        true if path is absolute
      • abspath

        public static String abspath​(String path)
        Convert path to add a leading '/'; assumes canonical.
        Parameters:
        path - convert this path
        Returns:
        absolute version