public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpRequest,HttpObject>
HttpResponse and HttpContent.
 The original content is replaced with the new content encoded by the
 EmbeddedChannel, which is created by beginEncode(HttpResponse, CharSequence).
 Once encoding is finished, the value of the 'Content-Encoding' header
 is set to the target content encoding, as returned by
 beginEncode(HttpResponse, CharSequence).
 Also, the 'Content-Length' header is updated to the length of the
 encoded content.  If there is no supported or allowed encoding in the
 corresponding HttpRequest's "Accept-Encoding" header,
 beginEncode(HttpResponse, CharSequence) should return null so that
 no encoding occurs (i.e. pass-through).
 
 Please note that this is an abstract class.  You have to extend this class
 and implement beginEncode(HttpResponse, CharSequence) properly to make
 this class functional.  For example, refer to the source code of
 HttpContentCompressor.
 
 This handler must be placed after HttpObjectEncoder in the pipeline
 so that this handler can intercept HTTP responses before HttpObjectEncoder
 converts them into ByteBufs.
| Modifier and Type | Class and Description | 
|---|---|
| static class  | HttpContentEncoder.Result | 
ChannelHandler.Sharable, ChannelHandler.Skip| Constructor and Description | 
|---|
| HttpContentEncoder() | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | acceptOutboundMessage(Object msg)Returns  trueif and only if the specified message can be encoded by this codec. | 
| protected abstract HttpContentEncoder.Result | beginEncode(HttpResponse headers,
           CharSequence acceptEncoding)Prepare to encode the HTTP message content. | 
| void | channelInactive(ChannelHandlerContext ctx)Calls  ChannelHandlerContext.fireChannelInactive()to forward
 to the nextChannelHandlerin theChannelPipeline. | 
| protected void | decode(ChannelHandlerContext ctx,
      HttpRequest msg,
      List<Object> out) | 
| protected void | encode(ChannelHandlerContext ctx,
      HttpObject msg,
      List<Object> out) | 
| void | handlerRemoved(ChannelHandlerContext ctx)Do nothing by default, sub-classes may override this method. | 
acceptInboundMessage, channelRead, writebind, channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, exceptionCaught, flush, handlerAdded, isSharable, read, userEventTriggeredpublic boolean acceptOutboundMessage(Object msg) throws Exception
MessageToMessageCodectrue if and only if the specified message can be encoded by this codec.acceptOutboundMessage in class MessageToMessageCodec<HttpRequest,HttpObject>msg - the messageExceptionprotected void decode(ChannelHandlerContext ctx, HttpRequest msg, List<Object> out) throws Exception
decode in class MessageToMessageCodec<HttpRequest,HttpObject>ExceptionMessageToMessageDecoder.decode(ChannelHandlerContext, Object, List)protected void encode(ChannelHandlerContext ctx, HttpObject msg, List<Object> out) throws Exception
encode in class MessageToMessageCodec<HttpRequest,HttpObject>ExceptionMessageToMessageEncoder.encode(ChannelHandlerContext, Object, List)protected abstract HttpContentEncoder.Result beginEncode(HttpResponse headers, CharSequence acceptEncoding) throws Exception
headers - the headersacceptEncoding - the value of the "Accept-Encoding" headerEmbeddedChannel that
         encodes the content into the target content encoding.
         null if acceptEncoding is unsupported or rejected
         and thus the content should be handled as-is (i.e. no encoding).Exceptionpublic void handlerRemoved(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapterhandlerRemoved in interface ChannelHandlerhandlerRemoved in class ChannelHandlerAdapterExceptionpublic void channelInactive(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapterChannelHandlerContext.fireChannelInactive() to forward
 to the next ChannelHandler in the ChannelPipeline.
 Sub-classes may override this method to change behavior.channelInactive in interface ChannelHandlerchannelInactive in class ChannelHandlerAdapterExceptionCopyright © 2008–2015 The Netty Project. All rights reserved.