public class ConfigureCompressionTomcatConnectorCustomizer extends Object implements TomcatConnectorCustomizer
Customizer for Tomcat Connectors that configures compression.
This customizer sets the compressableMimeType,
compression, compressionMinSize, and
noCompressionUserAgents property on each connector it is invoked
for.
Only those properties that have been configured are actually set. All other properties are not set, leaving Tomcat's defaults untouched.
| Modifier and Type | Field and Description |
|---|---|
static String[] |
DEFAULT_COMPRESSABLE_MIME_TYPES
MIME types that are configured as compressable when using
enableCompression(). |
| Modifier and Type | Method and Description |
|---|---|
void |
customize(org.apache.catalina.connector.Connector connector) |
static ConfigureCompressionTomcatConnectorCustomizer |
disableCompression()
Returns a customizer that disables compression.
|
static ConfigureCompressionTomcatConnectorCustomizer |
enableCompression()
Returns a customizer that enabled compression using a default set of MIME
types.
|
static ConfigureCompressionTomcatConnectorCustomizer |
enableCompression(String[] compressableMimeTypes,
Integer compressionMinSize,
String noCompressionUserAgents)
Returns a customizer that enables compression.
|
static ConfigureCompressionTomcatConnectorCustomizer |
enableCompression(String compressableMimeTypes,
Integer compressionMinSize,
String noCompressionUserAgents)
Returns a customizer that enables compression.
|
static ConfigureCompressionTomcatConnectorCustomizer |
forceCompression()
Returns a customizer that enforces compression.
|
public static final String[] DEFAULT_COMPRESSABLE_MIME_TYPES
enableCompression().public static ConfigureCompressionTomcatConnectorCustomizer disableCompression()
compression property to off
.public static ConfigureCompressionTomcatConnectorCustomizer enableCompression()
compression
property to on and the compressableMimeType
property to a string generated from the MIME types listed in
DEFAULT_COMPRESSABLE_MIME_TYPES.public static ConfigureCompressionTomcatConnectorCustomizer enableCompression(String[] compressableMimeTypes, Integer compressionMinSize, String noCompressionUserAgents)
compression to on. If the
respective parameters are not null, this customizer also
sets the compressableMediaType,
compressionMinSize, and noCompressionUserAgents
properties.compressableMimeTypes - MIME types for which compression shall be enabled. The
compressableMediaType property is set to a string
representing a comma-separated list generated from the
specified strings. If null , the
compressableMediaType property is not set,
keeping Tomcat's default value (
text/html,text/xml,text/plain,text/css,text/javascript,application/javascript
as of Tomcat 8.0.30).compressionMinSize - minimum size of a response body in bytes for which compression
shall be enabled. The compressionMinSize property
is set to a string generated from this number. If
null, the compressionMinSize
property is not set, keeping Tomcat's default value (
2048 as of Tomcat 8.0.30).noCompressionUserAgents - regular expression matching the User-Agent header
of clients for which compression shall be disabled, even if
they signal that they support compression. If
null, the noCompressionUserAgents
property is not set, keeping Tomcat's default value (
null as of Tomcat 8.0.30).public static ConfigureCompressionTomcatConnectorCustomizer enableCompression(String compressableMimeTypes, Integer compressionMinSize, String noCompressionUserAgents)
compression to on. If the
respective parameters are not null, this customizer also
sets the compressableMediaType,
compressionMinSize, and noCompressionUserAgents
properties.compressableMimeTypes - comma-separated list of MIME types for which compression shall
be enabled. If null, the
compressableMediaType property is not set,
keeping Tomcat's default value (
text/html,text/xml,text/plain,text/css,text/javascript,application/javascript
as of Tomcat 8.0.30).compressionMinSize - minimum size of a response body in bytes for which compression
shall be enabled. The compressionMinSize property
is set to a string generated from this number. If
null, the compressionMinSize
property is not set, keeping Tomcat's default value (
2048 as of Tomcat 8.0.30).noCompressionUserAgents - regular expression matching the User-Agent header
of clients for which compression shall be disabled, even if
they signal that they support compression. If
null, the noCompressionUserAgents
property is not set, keeping Tomcat's default value (
null as of Tomcat 8.0.30).public static ConfigureCompressionTomcatConnectorCustomizer forceCompression()
compression to force.public void customize(org.apache.catalina.connector.Connector connector)
customize in interface TomcatConnectorCustomizerCopyright © 2011–2017 aquenos GmbH. All rights reserved.