java.lang.Object
org.glassfish.grizzly.http.CompressionConfig
Compression configuration class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static interface
Common CompressionMode interface. -
Constructor Summary
ConstructorsConstructorDescriptionCompressionConfig
(CompressionConfig compression) The copy constructor.CompressionConfig
(CompressionConfig.CompressionMode compressionMode, int compressionMinSize, Set<String> compressibleMimeTypes, Set<String> noCompressionUserAgents) CompressionConfig
(CompressionConfig.CompressionMode compressionMode, int compressionMinSize, Set<String> compressibleMimeTypes, Set<String> noCompressionUserAgents, boolean decompressionEnabled) -
Method Summary
Modifier and TypeMethodDescriptionboolean
checkMimeType
(String contentType) Returns true if the resource with the given content-type could be compressed, or false otherwise.boolean
checkUserAgent
(HttpRequestPacket request) Returns true if based on this configuration user-agent, specified in theHttpRequestPacket
, can receive compressed data.Deprecated.Returns the read-only set of the mime-types, which are allowed to be compressed.int
Returns the minimum size of an entity, which will be compressed.Returns theCompressionConfig.CompressionMode
.Returns the read-only set of the user-agents, which will be always responded with uncompressed are.static boolean
isClientSupportCompression
(CompressionConfig compressionConfig, HttpRequestPacket request, String[] aliases) Returns true if a client, based on itsHttpRequestPacket
, could be responded with compressed data, or false otherwise.boolean
void
set
(CompressionConfig compression) Copies the source CompressionConfig object value into this object.void
setCompressableMimeTypes
(String... compressibleMimeTypes) Deprecated.void
setCompressableMimeTypes
(Set<String> compressibleMimeTypes) Deprecated.void
setCompressibleMimeTypes
(String... compressibleMimeTypes) Sets the set of the mime-types, which are allowed to be compressed.void
setCompressibleMimeTypes
(Set<String> compressibleMimeTypes) Sets the set of the mime-types, which are allowed to be compressed.void
setCompressionMinSize
(int compressionMinSize) Sets the minimum size of an entity, which will be compressed.void
Sets theCompressionConfig.CompressionMode
.void
setDecompressionEnabled
(boolean decompressionEnabled) If set totrue
content-encoding header for incoming data will be respected and data will be decompressed and the decompressed stream will be passed on.void
setNoCompressionUserAgents
(String... noCompressionUserAgents) Sets the set of the user-agents, which will be always responded with uncompressed data.void
setNoCompressionUserAgents
(Set<String> noCompressionUserAgents) Sets the set of the user-agents, which will be always responded with uncompressed data.
-
Constructor Details
-
CompressionConfig
public CompressionConfig() -
CompressionConfig
The copy constructor. The newly constructed CompressionConfig object will have the same settings as the source one, but actual values will be independent, so changes to one CompressionConfig object will not affect the other one. -
CompressionConfig
public CompressionConfig(CompressionConfig.CompressionMode compressionMode, int compressionMinSize, Set<String> compressibleMimeTypes, Set<String> noCompressionUserAgents) -
CompressionConfig
public CompressionConfig(CompressionConfig.CompressionMode compressionMode, int compressionMinSize, Set<String> compressibleMimeTypes, Set<String> noCompressionUserAgents, boolean decompressionEnabled)
-
-
Method Details
-
set
Copies the source CompressionConfig object value into this object. As the result this CompressionConfig object will have the same settings as the source one, but actual values will be independent, so changes to one CompressionConfig object will not affect the other one. -
getCompressionMode
Returns theCompressionConfig.CompressionMode
. -
setCompressionMode
Sets theCompressionConfig.CompressionMode
. -
getCompressionMinSize
public int getCompressionMinSize()Returns the minimum size of an entity, which will be compressed. -
setCompressionMinSize
public void setCompressionMinSize(int compressionMinSize) Sets the minimum size of an entity, which will be compressed. -
getCompressableMimeTypes
Deprecated.Returns the read-only set of the mime-types, which are allowed to be compressed. Empty set means *all* mime-types are allowed to be compressed. -
setCompressableMimeTypes
Deprecated.Sets the set of the mime-types, which are allowed to be compressed. Empty set means *all* mime-types are allowed to be compressed. Please note that CompressionConfig object will copy the source Set content, so further changes made on the source Set will not affect CompressionConfig object state. -
setCompressableMimeTypes
Deprecated.Sets the set of the mime-types, which are allowed to be compressed. Empty set means *all* mime-types are allowed to be compressed. Please note that CompressionConfig object will copy the source Set content, so further changes made on the source Set will not affect CompressionConfig object state. -
getCompressibleMimeTypes
Returns the read-only set of the mime-types, which are allowed to be compressed. Empty set means *all* mime-types are allowed to be compressed.- Since:
- 2.3.29
-
setCompressibleMimeTypes
Sets the set of the mime-types, which are allowed to be compressed. Empty set means *all* mime-types are allowed to be compressed. Please note that CompressionConfig object will copy the source Set content, so further changes made on the source Set will not affect CompressionConfig object state.- Since:
- 2.3.29
-
setCompressibleMimeTypes
Sets the set of the mime-types, which are allowed to be compressed. Empty set means *all* mime-types are allowed to be compressed. Please note that CompressionConfig object will copy the source Set content, so further changes made on the source Set will not affect CompressionConfig object state.- Since:
- 2.3.29
-
getNoCompressionUserAgents
Returns the read-only set of the user-agents, which will be always responded with uncompressed are. Empty set means that compressed data could be sent to *all* user-agents. -
setNoCompressionUserAgents
Sets the set of the user-agents, which will be always responded with uncompressed data. Empty set means that compressed data could be sent to *all* user-agents. Please note that CompressionConfig object will copy the source Set content, so further changes made on the source Set will not affect CompressionConfig object state. -
setNoCompressionUserAgents
Sets the set of the user-agents, which will be always responded with uncompressed data. Empty set means that compressed data could be sent to *all* user-agents. Please note that CompressionConfig object will copy the source Set content, so further changes made on the source Set will not affect CompressionConfig object state. -
isDecompressionEnabled
public boolean isDecompressionEnabled()- Returns:
true
if decompression of incoming data is enabled.- Since:
- 2.3.29
-
setDecompressionEnabled
public void setDecompressionEnabled(boolean decompressionEnabled) If set totrue
content-encoding header for incoming data will be respected and data will be decompressed and the decompressed stream will be passed on.- Since:
- 2.3.29
-
isClientSupportCompression
public static boolean isClientSupportCompression(CompressionConfig compressionConfig, HttpRequestPacket request, String[] aliases) Returns true if a client, based on itsHttpRequestPacket
, could be responded with compressed data, or false otherwise.- Parameters:
compressionConfig
-CompressionConfig
request
- client-sideHttpRequestPacket
aliases
- compression algorithm aliases (to match with Accept-Encoding header)- Returns:
- true if a client, based on its
HttpRequestPacket
, could be responded with compressed data, or false otherwise
-
checkUserAgent
Returns true if based on this configuration user-agent, specified in theHttpRequestPacket
, can receive compressed data. -
checkMimeType
Returns true if the resource with the given content-type could be compressed, or false otherwise.
-
getCompressibleMimeTypes()