Class CompressionEncodingFilter

java.lang.Object
org.glassfish.grizzly.http.server.CompressionEncodingFilter
All Implemented Interfaces:
org.glassfish.grizzly.http.EncodingFilter

public class CompressionEncodingFilter extends Object implements org.glassfish.grizzly.http.EncodingFilter
  • Constructor Summary

    Constructors
    Constructor
    Description
    CompressionEncodingFilter(org.glassfish.grizzly.http.CompressionConfig.CompressionModeI compressionMode, int compressionMinSize, String[] compressibleMimeTypes, String[] noCompressionUserAgents, String[] aliases)
    Creates a new CompressionEncodingFilter based on the provided configuration details.
    CompressionEncodingFilter(org.glassfish.grizzly.http.CompressionConfig.CompressionModeI compressionMode, int compressionMinSize, String[] compressibleMimeTypes, String[] noCompressionUserAgents, String[] aliases, boolean enableDecompression)
    Creates a new CompressionEncodingFilter based on the provided configuration details.
    CompressionEncodingFilter(org.glassfish.grizzly.http.CompressionConfig compressionConfig, String[] aliases)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    applyDecoding(org.glassfish.grizzly.http.HttpHeader httpPacket)
     
    boolean
    applyEncoding(org.glassfish.grizzly.http.HttpHeader httpPacket)
     
    protected static boolean
    canCompressHttpResponse(org.glassfish.grizzly.http.HttpResponsePacket response, org.glassfish.grizzly.http.CompressionConfig compressionConfig, String[] aliases)
    Returns true if the HttpResponsePacket could be compressed, or false otherwise.
    protected static boolean
    canDecompressHttpRequest(org.glassfish.grizzly.http.HttpRequestPacket request, org.glassfish.grizzly.http.CompressionConfig config, String[] aliases)
    Returns true if the HttpResponsePacket could be compressed, or false otherwise.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CompressionEncodingFilter

      public CompressionEncodingFilter(org.glassfish.grizzly.http.CompressionConfig compressionConfig, String[] aliases)
    • CompressionEncodingFilter

      public CompressionEncodingFilter(org.glassfish.grizzly.http.CompressionConfig.CompressionModeI compressionMode, int compressionMinSize, String[] compressibleMimeTypes, String[] noCompressionUserAgents, String[] aliases)
      Creates a new CompressionEncodingFilter based on the provided configuration details.
      Parameters:
      compressionMode - is compression on, off, or forced.
      compressionMinSize - the minimum size, in bytes, the resource must be before being considered for compression.
      compressibleMimeTypes - resource mime types that may be compressed. if null or zero-length, then there will be no type restriction.
      noCompressionUserAgents - user agents for which compression will not be performed. If null or zero-length, the user agent will not be considered.
      aliases - aliases for the compression name as defined in the accept-encoding header of the request.
    • CompressionEncodingFilter

      public CompressionEncodingFilter(org.glassfish.grizzly.http.CompressionConfig.CompressionModeI compressionMode, int compressionMinSize, String[] compressibleMimeTypes, String[] noCompressionUserAgents, String[] aliases, boolean enableDecompression)
      Creates a new CompressionEncodingFilter based on the provided configuration details.
      Parameters:
      compressionMode - is compression on, off, or forced.
      compressionMinSize - the minimum size, in bytes, the resource must be before being considered for compression.
      compressibleMimeTypes - resource mime types that may be compressed. if null or zero-length, then there will be no type restriction.
      noCompressionUserAgents - user agents for which compression will not be performed. If null or zero-length, the user agent will not be considered.
      aliases - aliases for the compression name as defined in the accept-encoding header of the request.
      enableDecompression - enabled decompression of incoming data according to the content-encoding header
      Since:
      2.3.29
  • Method Details

    • applyEncoding

      public boolean applyEncoding(org.glassfish.grizzly.http.HttpHeader httpPacket)
      Specified by:
      applyEncoding in interface org.glassfish.grizzly.http.EncodingFilter
    • applyDecoding

      public boolean applyDecoding(org.glassfish.grizzly.http.HttpHeader httpPacket)
      Specified by:
      applyDecoding in interface org.glassfish.grizzly.http.EncodingFilter
    • canCompressHttpResponse

      protected static boolean canCompressHttpResponse(org.glassfish.grizzly.http.HttpResponsePacket response, org.glassfish.grizzly.http.CompressionConfig compressionConfig, String[] aliases)
      Returns true if the HttpResponsePacket could be compressed, or false otherwise. The method checks if client supports compression and if the resource, that we are about to send matches CompressionConfig configuration.
    • canDecompressHttpRequest

      protected static boolean canDecompressHttpRequest(org.glassfish.grizzly.http.HttpRequestPacket request, org.glassfish.grizzly.http.CompressionConfig config, String[] aliases)
      Returns true if the HttpResponsePacket could be compressed, or false otherwise. The method checks if client supports compression and if the resource, that we are about to send matches CompressionConfig configuration.