Package org.glassfish.grizzly.http
Class GZipContentEncoding
- java.lang.Object
-
- org.glassfish.grizzly.http.GZipContentEncoding
-
- All Implemented Interfaces:
ContentEncoding
public class GZipContentEncoding extends java.lang.Object implements ContentEncoding
GZipContentEncodingimplementation, which compresses/decompresses HTTP content using gzip algorithm.- Author:
- Alexey Stashok
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_IN_BUFFER_SIZEstatic intDEFAULT_OUT_BUFFER_SIZEstatic java.lang.StringNAME
-
Constructor Summary
Constructors Constructor Description GZipContentEncoding()Construct GZipContentEncoding using default buffer sizes.GZipContentEncoding(int inBufferSize, int outBufferSize)Construct GZipContentEncoding using specific buffer sizes.GZipContentEncoding(int inBufferSize, int outBufferSize, int compressionLevel, int compressionStrategy, EncodingFilter encoderFilter)Construct GZipContentEncoding using specific buffer sizes, compression level and strategy.GZipContentEncoding(int inBufferSize, int outBufferSize, EncodingFilter encoderFilter)Construct GZipContentEncoding using specific buffer sizes, with default compression level and strategy.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ParsingResultdecode(Connection connection, HttpContent httpContent)Decode HTTP packet content represented byHttpContent.HttpContentencode(Connection connection, HttpContent httpContent)Encode HTTP packet content represented byHttpContent.booleanequals(java.lang.Object obj)java.lang.String[]getAliases()Get the ContentEncoding aliases.static java.lang.String[]getGzipAliases()java.lang.StringgetName()Get the ContentEncoding name.inthashCode()booleanwantDecode(HttpHeader header)Method should implement the logic, which decides if HTTP packet with the specificHttpHeadershould be decoded using this ContentEncoding.booleanwantEncode(HttpHeader header)Method should implement the logic, which decides if HTTP packet with the specificHttpHeadershould be encoded using this ContentEncoding.
-
-
-
Field Detail
-
DEFAULT_IN_BUFFER_SIZE
public static final int DEFAULT_IN_BUFFER_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_OUT_BUFFER_SIZE
public static final int DEFAULT_OUT_BUFFER_SIZE
- See Also:
- Constant Field Values
-
NAME
public static final java.lang.String NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GZipContentEncoding
public GZipContentEncoding()
Construct GZipContentEncoding using default buffer sizes.
-
GZipContentEncoding
public GZipContentEncoding(int inBufferSize, int outBufferSize)Construct GZipContentEncoding using specific buffer sizes.- Parameters:
inBufferSize- input buffer sizeoutBufferSize- output buffer size
-
GZipContentEncoding
public GZipContentEncoding(int inBufferSize, int outBufferSize, EncodingFilter encoderFilter)Construct GZipContentEncoding using specific buffer sizes, with default compression level and strategy.- Parameters:
inBufferSize- input buffer sizeoutBufferSize- output buffer sizeencoderFilter-EncodingFilter, which will decide if GZipContentEncoding should be applied to encode specificHttpHeaderpacket.
-
GZipContentEncoding
public GZipContentEncoding(int inBufferSize, int outBufferSize, int compressionLevel, int compressionStrategy, EncodingFilter encoderFilter)Construct GZipContentEncoding using specific buffer sizes, compression level and strategy.- Parameters:
inBufferSize- input buffer sizeoutBufferSize- output buffer sizecompressionLevel- the compression level used by the GZipEncodercompressionStrategy- the compression strategy used by the GZipEncoderencoderFilter-EncodingFilter, which will decide if GZipContentEncoding should be applied to encode specificHttpHeaderpacket.
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:ContentEncodingGet the ContentEncoding name.- Specified by:
getNamein interfaceContentEncoding- Returns:
- the ContentEncoding name.
-
getAliases
public java.lang.String[] getAliases()
Description copied from interface:ContentEncodingGet the ContentEncoding aliases.- Specified by:
getAliasesin interfaceContentEncoding- Returns:
- the ContentEncoding aliases.
-
getGzipAliases
public static java.lang.String[] getGzipAliases()
-
wantDecode
public final boolean wantDecode(HttpHeader header)
Description copied from interface:ContentEncodingMethod should implement the logic, which decides if HTTP packet with the specificHttpHeadershould be decoded using this ContentEncoding.- Specified by:
wantDecodein interfaceContentEncoding- Parameters:
header- HTTP packet header.- Returns:
- true, if this ContentEncoding should be used to decode the HTTP packet, or false otherwise.
-
wantEncode
public final boolean wantEncode(HttpHeader header)
Description copied from interface:ContentEncodingMethod should implement the logic, which decides if HTTP packet with the specificHttpHeadershould be encoded using this ContentEncoding.- Specified by:
wantEncodein interfaceContentEncoding- Parameters:
header- HTTP packet header.- Returns:
- true, if this ContentEncoding should be used to encode the HTTP packet, or false otherwise.
-
decode
public ParsingResult decode(Connection connection, HttpContent httpContent)
Description copied from interface:ContentEncodingDecode HTTP packet content represented byHttpContent.- Specified by:
decodein interfaceContentEncoding- Parameters:
connection-Connection.httpContent-HttpContentto decode.- Returns:
ParsingResult, which represents the result of decoding.
-
encode
public HttpContent encode(Connection connection, HttpContent httpContent)
Description copied from interface:ContentEncodingEncode HTTP packet content represented byHttpContent.- Specified by:
encodein interfaceContentEncoding- Parameters:
connection-Connection.httpContent-HttpContentto encode.- Returns:
- encoded
HttpContent.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-