HttpResponse and HttpContent.
The original content is replaced with the new content encoded by the
EmbeddedChannel, which is created by beginEncode(HttpResponse, String).
Once encoding is finished, the value of the 'Content-Encoding' header
is set to the target content encoding, as returned by
beginEncode(HttpResponse, 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 HttpRequest's "Accept-Encoding" header,
beginEncode(HttpResponse, String) 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, String) 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 |
|---|---|
| public static class | |
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| private final Queue | |
| private EmbeddedChannel | |
| private HttpContentEncoder. | |
| private static final CharSequence | |
| private static final CharSequence |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | acceptOutboundMessage(Object
the message msg)Overrides io. true if and only if the specified message can be encoded by this codec.
|
| protected abstract HttpContentEncoder. | Returns: the result of preparation, which is composed of the determined target content encoding and a newEmbeddedChannel 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).the http response httpResponse, String the value of the acceptEncoding)"Accept-Encoding" headerPrepare to encode the HTTP message content. |
| public void | channelInactive(ChannelHandlerContext ctx)
Overrides io. Implements io. ChannelHandlerContext#fireChannelInactive() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
|
| private void | |
| private void | |
| protected void | decode(ChannelHandlerContext ctx, HttpRequest msg, List<Object> out)
Implements abstract io. |
| protected void | encode(ChannelHandlerContext ctx, HttpObject msg, List<Object> out)
Implements abstract io. |
| private void | |
| private boolean | |
| private void | |
| private static void | |
| private static void | |
| private void | |
| private void | |
| public void | handlerRemoved(ChannelHandlerContext ctx)
Overrides io. Implements io. ChannelHandler was removed from the actual context and it doesn't handle events
anymore.
|
| private static boolean |
| acceptEncodingQueue | back to summary |
|---|---|
| private final Queue<CharSequence> acceptEncodingQueue | |
| encoder | back to summary |
|---|---|
| private EmbeddedChannel encoder | |
| state | back to summary |
|---|---|
| private HttpContentEncoder. | |
| ZERO_LENGTH_CONNECT | back to summary |
|---|---|
| private static final CharSequence ZERO_LENGTH_CONNECT | |
| ZERO_LENGTH_HEAD | back to summary |
|---|---|
| private static final CharSequence ZERO_LENGTH_HEAD | |
| HttpContentEncoder | back to summary |
|---|---|
| public HttpContentEncoder() | |
| acceptOutboundMessage | back to summary |
|---|---|
| public boolean acceptOutboundMessage(Object msg) throws Exception Overrides io. Doc from io. Returns | |
| beginEncode | back to summary |
|---|---|
| protected abstract HttpContentEncoder. Prepare to encode the HTTP message content.
| |
| channelInactive | back to summary |
|---|---|
| public void channelInactive(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, HttpRequest msg, List<Object> out) throws Exception Implements abstract io.
| |
| encode | back to summary |
|---|---|
| protected void encode(ChannelHandlerContext ctx, HttpObject msg, List<Object> out) throws Exception Implements abstract io.
| |
| encode | back to summary |
|---|---|
| private void encode(ByteBuf in, List<Object> out) | |
| encodeContent | back to summary |
|---|---|
| private boolean encodeContent(HttpContent c, List<Object> out) | |
| encodeFullResponse | back to summary |
|---|---|
| private void encodeFullResponse(HttpResponse newRes, HttpContent content, List<Object> out) | |
| ensureContent | back to summary |
|---|---|
| private static void ensureContent(HttpObject msg) | |
| ensureHeaders | back to summary |
|---|---|
| private static void ensureHeaders(HttpObject msg) | |
| fetchEncoderOutput | back to summary |
|---|---|
| private void fetchEncoderOutput(List<Object> out) | |
| finishEncode | back to summary |
|---|---|
| private void finishEncode(List<Object> out) | |
| handlerRemoved | back to summary |
|---|---|
| public void handlerRemoved(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Gets called after the
| |
| isPassthru | back to summary |
|---|---|
| private static boolean isPassthru(HttpVersion version, int code, CharSequence httpMethod) | |
| Modifier and Type | Field and Description |
|---|---|
| private final EmbeddedChannel | |
| private final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public EmbeddedChannel | |
| public String |
| contentEncoder | back to summary |
|---|---|
| private final EmbeddedChannel contentEncoder | |
| targetContentEncoding | back to summary |
|---|---|
| private final String targetContentEncoding | |
| Result | back to summary |
|---|---|
| public Result(String targetContentEncoding, EmbeddedChannel contentEncoder) | |
| contentEncoder | back to summary |
|---|---|
| public EmbeddedChannel contentEncoder() | |
| targetContentEncoding | back to summary |
|---|---|
| public String targetContentEncoding() | |
| Modifier and Type | Field and Description |
|---|---|
| public static final HttpContentEncoder. | |
| public static final HttpContentEncoder. | |
| public static final HttpContentEncoder. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static HttpContentEncoder. | |
| public static HttpContentEncoder. |
| AWAIT_CONTENT | back to summary |
|---|---|
| public static final HttpContentEncoder. | |
| AWAIT_HEADERS | back to summary |
|---|---|
| public static final HttpContentEncoder. | |
| PASS_THROUGH | back to summary |
|---|---|
| public static final HttpContentEncoder. | |
| State | back to summary |
|---|---|
| private State() | |
| valueOf | back to summary |
|---|---|
| public static HttpContentEncoder. | |
| values | back to summary |
|---|---|
| public static HttpContentEncoder. | |