Class CompressionConfig
java.lang.Object
org.apache.coyote.CompressionConfig
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionString[]Return compression level.intintbooleanDeprecated.Obtain the String form of the regular expression that defines the user agents to not use gzip with.voidsetCompressibleMimeType(String valueS) voidsetCompression(String compression) Set compression level.voidsetCompressionMinSize(int compressionMinSize) Set Minimum size to trigger compression.voidsetNoCompressionStrongETag(boolean noCompressionStrongETag) Deprecated.Will be removed in Tomcat 10 where it will be hard-coded totruevoidsetNoCompressionUserAgents(String noCompressionUserAgents) Set no compression user agent pattern.booleanuseCompression(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.
-
Constructor Details
-
CompressionConfig
public CompressionConfig()
-
-
Method Details
-
setCompression
Set compression level.- Parameters:
compression- One ofon,force,offor the minimum compression size in bytes which implieson
-
getCompression
Return compression level.- Returns:
- The current compression level in string form (off/on/force)
-
getCompressionLevel
public int getCompressionLevel() -
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
-
setNoCompressionUserAgents
Set no compression user agent pattern. Regular expression as supported byPattern. e.g.:gorilla|desesplorer|tigrus.- Parameters:
noCompressionUserAgents- The regular expression for user agent strings for which compression should not be applied
-
getCompressibleMimeType
-
setCompressibleMimeType
-
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
-
getNoCompressionStrongETag
Deprecated.Will be removed in Tomcat 10 where it will be hard-coded totrueDetermine if compression is disabled if the resource has a strong ETag.- Returns:
trueif compression is disabled, otherwisefalse
-
setNoCompressionStrongETag
Deprecated.Will be removed in Tomcat 10 where it will be hard-coded totrueSet whether compression is disabled for resources with a strong ETag.- Parameters:
noCompressionStrongETag-trueif compression is disabled, otherwisefalse
-
useCompression
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 responseresponse- The response to consider compressing- Returns:
trueif compression was enabled for the given response, otherwisefalse
-
true