HttpRequest and HttpContent.
The original content is replaced with the new content decoded by the
EmbeddedChannel, which is created by newContentDecoder(String).
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(String) 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(String) 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 ByteBufs into HTTP requests.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| protected ChannelHandlerContext | |
| private EmbeddedChannel | |
| pack-priv static final String | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | channelInactive(ChannelHandlerContext ctx)
Overrides io. Implements io. ChannelHandlerContext#fireChannelInactive() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
|
| public void | channelReadComplete(ChannelHandlerContext ctx)
Overrides io. Implements io. ChannelHandlerContext#fireChannelReadComplete() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
|
| private void | |
| private void | |
| protected void | decode(ChannelHandlerContext
the ctx, HttpObject ChannelHandlerContext which this MessageToMessageDecoder belongs tothe message to decode to an other one msg, List<Object> the out)List to which decoded messages should be addedImplements abstract io. |
| private void | |
| private void | |
| 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 io. Implements io. ChannelHandler was added to the actual context and it's ready to handle events.
|
| public void | handlerRemoved(ChannelHandlerContext ctx)
Overrides io. Implements io. ChannelHandler was removed from the actual context and it doesn't handle events
anymore.
|
| protected abstract EmbeddedChannel | Returns: a newEmbeddedChannel 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 | |
| decoder | back to summary |
|---|---|
| private EmbeddedChannel decoder | |
| 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 io. Implements io. Doc from io. Calls
| |
| channelReadComplete | back to summary |
|---|---|
| public void channelReadComplete(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Calls
| |
| cleanup | back to summary |
|---|---|
| private void cleanup() | |
| cleanupSafely | back to summary |
|---|---|
| private void cleanupSafely(ChannelHandlerContext ctx) | |
| decode | back to summary |
|---|---|
| protected void decode(ChannelHandlerContext ctx, HttpObject msg, List<Object> out) throws Exception Implements abstract io. Doc from io. Decode from one message to an other. This method will be called for each written message that can be handled by this decoder.
| |
| decode | back to summary |
|---|---|
| private void decode(ByteBuf in, List<Object> out) | |
| decodeContent | back to summary |
|---|---|
| private void decodeContent(HttpContent c, List<Object> out) | |
| fetchDecoderOutput | back to summary |
|---|---|
| private void fetchDecoderOutput(List<Object> out) | |
| finishDecode | back to summary |
|---|---|
| private void finishDecode(List<Object> out) | |
| getTargetContentEncoding | back to summary |
|---|---|
| protected String getTargetContentEncoding(String 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 io. Implements io. Doc from io. Gets called after the
| |
| handlerRemoved | back to summary |
|---|---|
| public void handlerRemoved(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Gets called after the
| |
| newContentDecoder | back to summary |
|---|---|
| protected abstract EmbeddedChannel newContentDecoder(String contentEncoding) throws Exception Returns a new
| |