HttpRequest and HttpContent.
The original content is replaced with the new content decoded by the
Decompressor, which is created by newContentDecoder(CharSequence).
Once decoding is finished, the value of the 'Content-Encoding'
header is set to the target content encoding, as returned by getTargetContentEncoding(String).
Also, the 'Content-Length' header is updated to the length of the
decoded content. If the content encoding of the original is not supported
by the decoder, newContentDecoder(CharSequence) should return null
so that no decoding occurs (i.e. pass-through).
Please note that this is an abstract class. You have to extend this class
and implement newContentDecoder(CharSequence) properly to make this class
functional. For example, refer to the source code of HttpContentDecompressor.
This handler must be placed after HttpObjectDecoder in the pipeline
so that this handler can intercept HTTP requests after HttpObjectDecoder
converts Buffers into HTTP requests.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| protected ChannelHandlerContext | |
| private Decompressor | |
| pack-priv static final String | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | channelInactive(ChannelHandlerContext ctx)
Overrides default io. Channel of the ChannelHandlerContext was registered is now inactive and reached its
end of lifetime.
|
| public void | channelReadComplete(ChannelHandlerContext ctx)
Overrides default io. channelRead(ChannelHandlerContext, Object).
|
| private void | |
| private void | |
| protected void | decodeAndClose(ChannelHandlerContext
the ctx, HttpObject ChannelHandlerContext which this MessageToMessageDecoder belongs tothe message to decode to another one msg)Overrides io. |
| private void | |
| private void | |
| protected String | Returns: the expected content encoding of the new contentthe value of the contentEncoding)"Content-Encoding" headerReturns the expected content encoding of the decoded content. |
| public void | handlerAdded(ChannelHandlerContext ctx)
Overrides default io. ChannelHandler was added to the actual context and it's ready to handle events.
|
| public void | handlerRemoved(ChannelHandlerContext ctx)
Overrides default io. ChannelHandler was removed from the actual context and it doesn't handle events
anymore.
|
| protected abstract Decompressor | Returns: a newDecompressor if the specified encoding is supported.
null otherwise (alternatively, you can throw an exception
to block unknown encoding).the value of the contentEncoding)"Content-Encoding" headerReturns a new |
| continueResponse | back to summary |
|---|---|
| private boolean continueResponse | |
| ctx | back to summary |
|---|---|
| protected ChannelHandlerContext ctx | |
| decompressor | back to summary |
|---|---|
| private Decompressor decompressor | |
| IDENTITY | back to summary |
|---|---|
| pack-priv static final String IDENTITY | |
| needRead | back to summary |
|---|---|
| private boolean needRead | |
| HttpContentDecoder | back to summary |
|---|---|
| public HttpContentDecoder() | |
| channelInactive | back to summary |
|---|---|
| public void channelInactive(ChannelHandlerContext ctx) throws Exception Overrides default io. Doc from io. The
| |
| channelReadComplete | back to summary |
|---|---|
| public void channelReadComplete(ChannelHandlerContext ctx) throws Exception Overrides default io. Doc from io. Invoked when the last message read by the current read operation has been consumed by
| |
| cleanup | back to summary |
|---|---|
| private void cleanup() | |
| cleanupSafely | back to summary |
|---|---|
| private void cleanupSafely(ChannelHandlerContext ctx) | |
| decodeAndClose | back to summary |
|---|---|
| protected void decodeAndClose(ChannelHandlerContext ctx, HttpObject msg) throws Exception Overrides io. Doc from io. Decode from one message to another. This method will be called for each written message that can be handled by this decoder. The message will not be automatically disposed of after this call. Instead, the responsibility of ensuring that messages are disposed of falls upon the implementor of this method.
Subclasses that wish to have incoming messages automatically disposed of should instead override the
| |
| decodeContent | back to summary |
|---|---|
| private void decodeContent(ChannelHandlerContext ctx, HttpContent<?> c) | |
| fireChannelRead | back to summary |
|---|---|
| private void fireChannelRead(ChannelHandlerContext ctx, Object msg) | |
| getTargetContentEncoding | back to summary |
|---|---|
| protected String getTargetContentEncoding(CharSequence contentEncoding) throws Exception Returns the expected content encoding of the decoded content.
This getMethod returns
| |
| handlerAdded | back to summary |
|---|---|
| public void handlerAdded(ChannelHandlerContext ctx) throws Exception Overrides default io. Doc from io. Gets called after the
| |
| handlerRemoved | back to summary |
|---|---|
| public void handlerRemoved(ChannelHandlerContext ctx) throws Exception Overrides default io. Doc from io. Gets called after the
| |
| newContentDecoder | back to summary |
|---|---|
| protected abstract Decompressor newContentDecoder(CharSequence contentEncoding) throws Exception Returns a new
| |