Encodes the content of the outbound {@link HttpResponse} and {@link HttpContent}. The original content is replaced with the new content encoded by the {@link EmbeddedByteChannel}, which is created by {@link #beginEncode(HttpMessage,HttpContent,String)}. Once encoding is finished, the value of the
'Content-Encoding' header is set to the target content encoding, as returned by {@link #beginEncode(HttpMessage,HttpContent,String)}. 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 {@link HttpRequest}'s {@code "Accept-Encoding"} header,{@link #beginEncode(HttpMessage,HttpContent,String)} should return {@code null} so thatno encoding occurs (i.e. pass-through).
Please note that this is an abstract class. You have to extend this class and implement {@link #beginEncode(HttpMessage,HttpContent,String)} properly to makethis class functional. For example, refer to the source code of {@link HttpContentCompressor}.
This handler must be placed after {@link HttpObjectEncoder} in the pipelineso that this handler can intercept HTTP responses before {@link HttpObjectEncoder}converts them into {@link ByteBuf}s.