Class CompressionConfig


public class CompressionConfig extends Object
  • Constructor Details

    • CompressionConfig

      public CompressionConfig()
  • Method Details

    • setCompression

      public void setCompression(String compression)
      Set compression level.
      compression - One of on, force, off or the minimum compression size in bytes which implies on
    • getCompression

      public String getCompression()
      Return compression level.
      The current compression level in string form (off/on/force)
    • getCompressionLevel

      public int getCompressionLevel()
    • getNoCompressionUserAgents

      public String getNoCompressionUserAgents()
      Obtain the String form of the regular expression that defines the user agents to not use gzip with.
      The regular expression as a String
    • getNoCompressionUserAgentsPattern

      public Pattern getNoCompressionUserAgentsPattern()
    • setNoCompressionUserAgents

      public void setNoCompressionUserAgents(String noCompressionUserAgents)
      Set no compression user agent pattern. Regular expression as supported by Pattern. e.g.: gorilla|desesplorer|tigrus.
      noCompressionUserAgents - The regular expression for user agent strings for which compression should not be applied
    • getCompressibleMimeType

      public String getCompressibleMimeType()
    • setCompressibleMimeType

      public void setCompressibleMimeType(String valueS)
    • getCompressibleMimeTypes

      public String[] getCompressibleMimeTypes()
    • getCompressionMinSize

      public int getCompressionMinSize()
    • setCompressionMinSize

      public void setCompressionMinSize(int compressionMinSize)
      Set Minimum size to trigger compression.
      compressionMinSize - The minimum content length required for compression in bytes
    • getNoCompressionStrongETag

      @Deprecated public boolean getNoCompressionStrongETag()
      Will be removed in Tomcat 10 where it will be hard-coded to true
      Determine if compression is disabled if the resource has a strong ETag.
      true if compression is disabled, otherwise false
    • setNoCompressionStrongETag

      @Deprecated public void setNoCompressionStrongETag(boolean noCompressionStrongETag)
      Will be removed in Tomcat 10 where it will be hard-coded to true
      Set whether compression is disabled for resources with a strong ETag.
      noCompressionStrongETag - true if compression is disabled, otherwise false
    • useCompression

      public boolean useCompression(Request request, Response response)
      Determines if compression should be enabled for the given response and if it is, sets any necessary headers to mark it as such.
      request - The request that triggered the response
      response - The response to consider compressing
      true if compression was enabled for the given response, otherwise false