public class HttpContentCompressor extends HttpContentEncoder
HttpMessage and an HttpChunk in gzip or
deflate encoding while respecting the "Accept-Encoding" header.
If there is no matching encoding, no compression is done. For more
information on how this handler modifies the message, please refer to
HttpContentEncoder.ChannelHandler.Sharable| Constructor and Description |
|---|
HttpContentCompressor()
Creates a new handler with the default compression level (6).
|
HttpContentCompressor(int compressionLevel)
Creates a new handler with the specified compression level.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
getTargetContentEncoding(String acceptEncoding)
Returns the expected content encoding of the encoded content.
|
protected EncoderEmbedder<ChannelBuffer> |
newContentEncoder(String acceptEncoding)
Returns a new
EncoderEmbedder that encodes the HTTP message
content. |
messageReceived, writeRequestedbindRequested, channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, closeRequested, connectRequested, disconnectRequested, exceptionCaught, handleDownstream, handleUpstream, setInterestOpsRequested, unbindRequested, writeCompletepublic HttpContentCompressor()
public HttpContentCompressor(int compressionLevel)
compressionLevel - 1 yields the fastest compression and 9 yields the
best compression. 0 means no compression. The default
compression level is 6.protected EncoderEmbedder<ChannelBuffer> newContentEncoder(String acceptEncoding) throws Exception
HttpContentEncoderEncoderEmbedder that encodes the HTTP message
content.newContentEncoder in class HttpContentEncoderacceptEncoding - the value of the "Accept-Encoding" headerEncoderEmbedder if there is a supported encoding
in acceptEncoding. null otherwise.Exceptionprotected String getTargetContentEncoding(String acceptEncoding) throws Exception
HttpContentEncodergetTargetContentEncoding in class HttpContentEncoderacceptEncoding - the value of the "Accept-Encoding" headerExceptionCopyright © 2008-2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.