org.glassfish.grizzly.http
Class GZipContentEncoding

java.lang.Object
  extended by org.glassfish.grizzly.http.GZipContentEncoding
All Implemented Interfaces:
ContentEncoding

public class GZipContentEncoding
extends Object
implements ContentEncoding

GZip ContentEncoding implementation, which compresses/decompresses HTTP content using gzip algorithm.

Author:
Alexey Stashok

Field Summary
static int DEFAULT_IN_BUFFER_SIZE
           
static int DEFAULT_OUT_BUFFER_SIZE
           
 
Constructor Summary
GZipContentEncoding()
          Construct GZipContentEncoding using default buffer sizes.
GZipContentEncoding(int inBufferSize, int outBufferSize)
          Construct GZipContentEncoding using specific buffer sizes.
GZipContentEncoding(int inBufferSize, int outBufferSize, EncodingFilter encoderFilter)
          Construct GZipContentEncoding using specific buffer sizes.
 
Method Summary
 ParsingResult decode(Connection connection, HttpContent httpContent)
          Decode HTTP packet content represented by HttpContent.
 HttpContent encode(Connection connection, HttpContent httpContent)
          Encode HTTP packet content represented by HttpContent.
 boolean equals(Object obj)
           
 String[] getAliases()
          Get the ContentEncoding aliases.
static String[] getGzipAliases()
           
 String getName()
          Get the ContentEncoding name.
 int hashCode()
           
 boolean wantDecode(HttpHeader header)
          Method should implement the logic, which decides if HTTP packet with the specific HttpHeader should be decoded using this ContentEncoding.
 boolean wantEncode(HttpHeader header)
          Method should implement the logic, which decides if HTTP packet with the specific HttpHeader should be encoded using this ContentEncoding.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

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
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 size
outBufferSize - output buffer size

GZipContentEncoding

public GZipContentEncoding(int inBufferSize,
                           int outBufferSize,
                           EncodingFilter encoderFilter)
Construct GZipContentEncoding using specific buffer sizes.

Parameters:
inBufferSize - input buffer size
outBufferSize - output buffer size
encoderFilter - EncodingFilter, which will decide if GZipContentEncoding should be applied to encode specific HttpHeader packet.
Method Detail

getName

public String getName()
Description copied from interface: ContentEncoding
Get the ContentEncoding name.

Specified by:
getName in interface ContentEncoding
Returns:
the ContentEncoding name.

getAliases

public String[] getAliases()
Description copied from interface: ContentEncoding
Get the ContentEncoding aliases.

Specified by:
getAliases in interface ContentEncoding
Returns:
the ContentEncoding aliases.

getGzipAliases

public static String[] getGzipAliases()

wantDecode

public final boolean wantDecode(HttpHeader header)
Description copied from interface: ContentEncoding
Method should implement the logic, which decides if HTTP packet with the specific HttpHeader should be decoded using this ContentEncoding.

Specified by:
wantDecode in interface ContentEncoding
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: ContentEncoding
Method should implement the logic, which decides if HTTP packet with the specific HttpHeader should be encoded using this ContentEncoding.

Specified by:
wantEncode in interface ContentEncoding
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: ContentEncoding
Decode HTTP packet content represented by HttpContent.

Specified by:
decode in interface ContentEncoding
Parameters:
connection - Connection.
httpContent - HttpContent to decode.
Returns:
ParsingResult, which represents the result of decoding.

encode

public HttpContent encode(Connection connection,
                          HttpContent httpContent)
Description copied from interface: ContentEncoding
Encode HTTP packet content represented by HttpContent.

Specified by:
encode in interface ContentEncoding
Parameters:
connection - Connection.
httpContent - HttpContent to encode.
Returns:
encoded HttpContent.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2012 Oracle Corporation. All Rights Reserved.