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
构造器和说明 |
---|
HttpContentCompressor()
Creates a new handler with the default compression level (6), default window size
() and default memory level ().
|
HttpContentCompressor(int compressionLevel)
Creates a new handler with the specified compression level, default window size
() and default memory level ().
|
HttpContentCompressor(int compressionLevel,
int windowBits,
int memLevel)
Creates a new handler with the specified compression level, window size, and memory level.
|
限定符和类型 | 方法和说明 |
---|---|
protected java.lang.String |
getTargetContentEncoding(java.lang.String acceptEncoding)
Returns the expected content encoding of the encoded content.
|
protected EncoderEmbedder<ChannelBuffer> |
newContentEncoder(HttpMessage msg,
java.lang.String acceptEncoding)
Returns a new
EncoderEmbedder that encodes the HTTP message
content. |
afterAdd, afterRemove, beforeAdd, beforeRemove, channelClosed, messageReceived, writeRequested
bindRequested, channelBound, channelConnected, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, closeRequested, connectRequested, disconnectRequested, exceptionCaught, handleDownstream, handleUpstream, setInterestOpsRequested, unbindRequested, writeComplete
public 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
.public HttpContentCompressor(int compressionLevel, int windowBits, int memLevel)
compressionLevel
- 1
yields the fastest compression and 9
yields the
best compression. 0
means no compression. The default
compression level is 6
.windowBits
- The base two logarithm of the size of the history buffer. The
value should be in the range 9
to 15
inclusive.
Larger values result in better compression at the expense of
memory usage. The default value is .memLevel
- How much memory should be allocated for the internal compression
state. 1
uses minimum memory and 9
uses maximum
memory. Larger values result in better and faster compression
at the expense of memory usage. The default value is .protected EncoderEmbedder<ChannelBuffer> newContentEncoder(HttpMessage msg, java.lang.String acceptEncoding) throws java.lang.Exception
HttpContentEncoder
EncoderEmbedder
that encodes the HTTP message
content.newContentEncoder
在类中 HttpContentEncoder
acceptEncoding
- the value of the "Accept-Encoding"
headerEncoderEmbedder
if there is a supported encoding
in acceptEncoding
. null
otherwise.java.lang.Exception
protected java.lang.String getTargetContentEncoding(java.lang.String acceptEncoding) throws java.lang.Exception
HttpContentEncoder
getTargetContentEncoding
在类中 HttpContentEncoder
acceptEncoding
- the value of the "Accept-Encoding"
headerjava.lang.Exception