Enum CompressedHttpServletResponse.Algorithm

    • Method Detail

      • values

        public static CompressedHttpServletResponse.Algorithm[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CompressedHttpServletResponse.Algorithm c : CompressedHttpServletResponse.Algorithm.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CompressedHttpServletResponse.Algorithm valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getEncodingDirective

        public String getEncodingDirective()
        Returns the encoding directive. This basically represents the unique identifier of the algorithm in the HTTP Accept-Encoding header as well as the HTTP Content-Encoding header.
        Returns:
        The directive.
      • getOutputStreamClass

        public Class<? extends OutputStream> getOutputStreamClass()
        Returns the output stream class being used.
        Returns:
        The output stream class being used.
      • isAvailable

        public boolean isAvailable()
        Returns true if this algorithm is available.
        Returns:
        true if this algorithm is available.
      • accepts

        public boolean accepts​(HttpServletRequest request)
        Returns true if the given request accepts this algorithm.
        Parameters:
        request - The involved HTTP servlet request.
        Returns:
        true if the given request accepts this algorithm.
      • createOutputStream

        public OutputStream createOutputStream​(HttpServletResponse response)
        Returns an output stream which is compressed using this algorithm for the given HTTP servlet response.
        Parameters:
        response - The HTTP servlet response to be compressed with this algorithm.
        Returns:
        An output stream which is compressed using this algorithm.
        Throws:
        UnsupportedOperationException - When the output stream cannot be constructed for some reason.
      • find

        public static Optional<CompressedHttpServletResponse.Algorithm> find​(HttpServletRequest request)
        Returns the best algorithm matching the given HTTP servlet request.
        Parameters:
        request - The HTTP servlet request to find the best algorithm for.
        Returns:
        The best algorithm matching the given HTTP servlet request.