CompressionConfig (Apache Tomcat 8.5.43 API Documentation)

org.apache.coyote

## Class CompressionConfig

- java.lang.Object
- - org.apache.coyote.CompressionConfig

-     public class CompressionConfig
      extends java.lang.Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompressionConfig()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getCompressibleMimeType()`
    `java.lang.String[]` | `getCompressibleMimeTypes()`
    `java.lang.String` | `getCompression()` Return compression level.
    `int` | `getCompressionLevel()`
    `int` | `getCompressionMinSize()`
    `java.lang.String` | `getNoCompressionUserAgents()` Obtain the String form of the regular expression that defines the user agents to not use gzip with.
    `java.util.regex.Pattern` | `getNoCompressionUserAgentsPattern()`
    `void` | `setCompressibleMimeType(java.lang.String valueS)`
    `void` | `setCompression(java.lang.String compression)` Set compression level.
    `void` | `setCompressionMinSize(int compressionMinSize)` Set Minimum size to trigger compression.
    `void` | `setNoCompressionUserAgents(java.lang.String noCompressionUserAgents)` Set no compression user agent pattern.
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CompressionConfig

          public CompressionConfig()

  - ### Method Detail

    - #### setCompression

          public void setCompression(java.lang.String compression)

      Set compression level.
      Parameters:
        `compression` - One of `on`, `force`, `off` or the minimum compression size in bytes which implies `on`

    - #### getCompression

          public java.lang.String getCompression()

      Return compression level.
      Returns:
        The current compression level in string form (off/on/force)

    - #### getCompressionLevel

          public int getCompressionLevel()

    - #### getNoCompressionUserAgents

          public java.lang.String getNoCompressionUserAgents()

      Obtain the String form of the regular expression that defines the user agents to not use gzip with.
      Returns:
        The regular expression as a String

    - #### getNoCompressionUserAgentsPattern

          public java.util.regex.Pattern getNoCompressionUserAgentsPattern()

    - #### setNoCompressionUserAgents

          public void setNoCompressionUserAgents(java.lang.String noCompressionUserAgents)

      Set no compression user agent pattern. Regular expression as supported by `Pattern`. e.g.: `gorilla|desesplorer|tigrus`.
      Parameters:
        `noCompressionUserAgents` - The regular expression for user agent strings for which compression should not be applied

    - #### getCompressibleMimeType

          public java.lang.String getCompressibleMimeType()

    - #### setCompressibleMimeType

          public void setCompressibleMimeType(java.lang.String valueS)

    - #### getCompressibleMimeTypes

          public java.lang.String[] getCompressibleMimeTypes()

    - #### getCompressionMinSize

          public int getCompressionMinSize()

    - #### setCompressionMinSize

          public void setCompressionMinSize(int compressionMinSize)

      Set Minimum size to trigger compression.
      Parameters:
        `compressionMinSize` - The minimum content length required for compression in bytes

    - #### 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.
      Parameters:
        `request` - The request that triggered the response
        `response` - The response to consider compressing
      Returns:
        `true` if compression was enabled for the given response, otherwise `false`

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.