Top Fields Constructors Methods
org.glassfish.grizzly.http.server

public Class CompressionEncodingFilter

extends Object
implements EncodingFilter
Class Inheritance
All Implemented Interfaces
org.glassfish.grizzly.http.EncodingFilter
Imports
java.util.Arrays, org.glassfish.grizzly.http.CompressionConfig, .CompressionConfig.CompressionMode, .CompressionConfig.CompressionModeI, .EncodingFilter, .HttpHeader, .HttpRequestPacket, .HttpResponsePacket, org.glassfish.grizzly.http.util.DataChunk, .Header, .MimeHeaders

Field Summary

Modifier and TypeField and Description
private final String[]
private final CompressionConfig

Constructor Summary

AccessConstructor and Description
public
CompressionEncodingFilter(final CompressionConfig compressionConfig, final String[] aliases)

public
CompressionEncodingFilter(CompressionConfig.CompressionModeI
is compression on, off, or forced.
compressionMode
,
int
the minimum size, in bytes, the resource must be before being considered for compression.
compressionMinSize
,
String[]
resource mime types that may be compressed. if null or zero-length, then there will be no type restriction.
compressibleMimeTypes
,
String[]
user agents for which compression will not be performed. If null or zero-length, the user agent will not be considered.
noCompressionUserAgents
,
String[]
aliases for the compression name as defined in the accept-encoding header of the request.
aliases
)

Creates a new CompressionEncodingFilter based on the provided configuration details.

public
CompressionEncodingFilter(CompressionConfig.CompressionModeI
is compression on, off, or forced.
compressionMode
,
int
the minimum size, in bytes, the resource must be before being considered for compression.
compressionMinSize
,
String[]
resource mime types that may be compressed. if null or zero-length, then there will be no type restriction.
compressibleMimeTypes
,
String[]
user agents for which compression will not be performed. If null or zero-length, the user agent will not be considered.
noCompressionUserAgents
,
String[]
aliases for the compression name as defined in the accept-encoding header of the request.
aliases
,
boolean
enabled decompression of incoming data according to the content-encoding header
enableDecompression
)

Creates a new CompressionEncodingFilter based on the provided configuration details.

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
protected static boolean
canCompressHttpResponse(final HttpResponsePacket response, final CompressionConfig compressionConfig, final String[] aliases)

Returns true if the HttpResponsePacket could be compressed, or false otherwise.

protected static boolean
canDecompressHttpRequest(final HttpRequestPacket request, final CompressionConfig config, final String[] aliases)

Returns true if the HttpResponsePacket could be compressed, or false otherwise.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aliasesback to summary
private final String[] aliases
compressionConfigback to summary
private final CompressionConfig compressionConfig

Constructor Detail

CompressionEncodingFilterback to summary
public CompressionEncodingFilter(final CompressionConfig compressionConfig, final String[] aliases)
CompressionEncodingFilterback to summary
public CompressionEncodingFilter(CompressionConfig.CompressionModeI compressionMode, int compressionMinSize, String[] compressibleMimeTypes, String[] noCompressionUserAgents, String[] aliases)

Creates a new CompressionEncodingFilter based on the provided configuration details.

Parameters
compressionMode:CompressionConfig.CompressionModeI

is compression on, off, or forced.

compressionMinSize:int

the minimum size, in bytes, the resource must be before being considered for compression.

compressibleMimeTypes:String[]

resource mime types that may be compressed. if null or zero-length, then there will be no type restriction.

noCompressionUserAgents:String[]

user agents for which compression will not be performed. If null or zero-length, the user agent will not be considered.

aliases:String[]

aliases for the compression name as defined in the accept-encoding header of the request.

CompressionEncodingFilterback to summary
public CompressionEncodingFilter(CompressionConfig.CompressionModeI compressionMode, int compressionMinSize, String[] compressibleMimeTypes, String[] noCompressionUserAgents, String[] aliases, boolean enableDecompression)

Creates a new CompressionEncodingFilter based on the provided configuration details.

Parameters
compressionMode:CompressionConfig.CompressionModeI

is compression on, off, or forced.

compressionMinSize:int

the minimum size, in bytes, the resource must be before being considered for compression.

compressibleMimeTypes:String[]

resource mime types that may be compressed. if null or zero-length, then there will be no type restriction.

noCompressionUserAgents:String[]

user agents for which compression will not be performed. If null or zero-length, the user agent will not be considered.

aliases:String[]

aliases for the compression name as defined in the accept-encoding header of the request.

enableDecompression:boolean

enabled decompression of incoming data according to the content-encoding header

Since
2.3.29

Method Detail

applyDecodingback to summary
public boolean applyDecoding(final HttpHeader httpPacket)

Implements org.glassfish.grizzly.http.EncodingFilter.applyDecoding.

Annotations
@Override
applyEncodingback to summary
public boolean applyEncoding(final HttpHeader httpPacket)

Implements org.glassfish.grizzly.http.EncodingFilter.applyEncoding.

Annotations
@Override
canCompressHttpResponseback to summary
protected static boolean canCompressHttpResponse(final HttpResponsePacket response, final CompressionConfig compressionConfig, final String[] aliases)

Returns true if the HttpResponsePacket could be compressed, or false otherwise. The method checks if client supports compression and if the resource, that we are about to send matches CompressionConfig configuration.

canDecompressHttpRequestback to summary
protected static boolean canDecompressHttpRequest(final HttpRequestPacket request, final CompressionConfig config, final String[] aliases)

Returns true if the HttpResponsePacket could be compressed, or false otherwise. The method checks if client supports compression and if the resource, that we are about to send matches CompressionConfig configuration.