Class HTTPUtils


  • public class HTTPUtils
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Set<java.lang.String> compression  
      private static java.lang.String default_type  
      private static java.util.Map<java.lang.String,​java.lang.String> file_types  
      static java.lang.String NL  
    • Constructor Summary

      Constructors 
      Constructor Description
      HTTPUtils()  
    • Field Detail

      • file_types

        private static final java.util.Map<java.lang.String,​java.lang.String> file_types
      • compression

        private static final java.util.Set<java.lang.String> compression
    • Constructor Detail

      • HTTPUtils

        public HTTPUtils()
    • Method Detail

      • guessContentTypeFromFileType

        public static java.lang.String guessContentTypeFromFileType​(java.lang.String file_type)
        Parameters:
        file_type - file extension
        Returns:
        apropriate content type string if found
      • isImageFileType

        public static boolean isImageFileType​(java.lang.String file_type)
      • canGZIP

        public static boolean canGZIP​(java.lang.String accept_encoding)
      • useCompressionForFileType

        public static boolean useCompressionForFileType​(java.lang.String file_type)
        Parameters:
        file_type - a file type like text/plain
        Returns:
        true if the file_type should be compressed
      • decodeChunkedEncoding

        public static java.io.InputStream decodeChunkedEncoding​(java.net.Socket socket)
                                                         throws java.io.IOException
        Throws:
        java.io.IOException
      • decodeChunkedEncoding

        public static java.io.InputStream decodeChunkedEncoding​(java.net.Socket socket,
                                                                boolean ignoreStatusCode)
                                                         throws java.io.IOException
        Throws:
        java.io.IOException