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 Buffers.
| Modifier and Type | Class and Description |
|---|---|
| public static class | |
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| private final Queue | |
| private Compressor | |
| private static final int | |
| 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 default io. Channel of the ChannelHandlerContext was registered is now inactive and reached its
end of lifetime.
|
| private void | |
| private void | |
| protected void | decode(ChannelHandlerContext ctx, HttpRequest msg)
Overrides io. |
| protected void | |
| private void | |
| protected void | encodeAndClose(ChannelHandlerContext ctx, HttpObject msg, List<Object> out)
Overrides io. |
| private boolean | |
| private void | encodeFullResponse(ChannelHandlerContext ctx, HttpResponse newRes, HttpContent<?> content, List<Object> out)
|
| private static void | |
| private static void | |
| private void | |
| public void | handlerRemoved(ChannelHandlerContext ctx)
Overrides default 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 | |
| compressor | back to summary |
|---|---|
| private Compressor compressor | |
| CONTINUE_CODE | back to summary |
|---|---|
| private static final int CONTINUE_CODE | |
| 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 default io. Doc from io. The
| |
| 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) throws Exception Overrides io.
| |
| decodeAndClose | back to summary |
|---|---|
| protected void decodeAndClose(ChannelHandlerContext ctx, HttpRequest msg) throws Exception Overrides io.
| |
| encode | back to summary |
|---|---|
| private void encode(Buffer in, BufferAllocator allocator, List<Object> out) | |
| encodeAndClose | back to summary |
|---|---|
| protected void encodeAndClose(ChannelHandlerContext ctx, HttpObject msg, List<Object> out) throws Exception Overrides io.
| |
| encodeContent | back to summary |
|---|---|
| private boolean encodeContent(ChannelHandlerContext ctx, HttpContent<?> c, List<Object> out) | |
| encodeFullResponse | back to summary |
|---|---|
| private void encodeFullResponse(ChannelHandlerContext ctx, 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) | |
| finishEncode | back to summary |
|---|---|
| private void finishEncode(BufferAllocator allocator, List<Object> out) | |
| handlerRemoved | back to summary |
|---|---|
| public void handlerRemoved(ChannelHandlerContext ctx) throws Exception Overrides default 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 Compressor | |
| private final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Compressor | |
| public String |
| contentCompressor | back to summary |
|---|---|
| private final Compressor contentCompressor | |
| targetContentEncoding | back to summary |
|---|---|
| private final String targetContentEncoding | |
| Result | back to summary |
|---|---|
| public Result(String targetContentEncoding, Compressor contentCompressor) | |
| contentCompressor | back to summary |
|---|---|
| public Compressor contentCompressor() | |
| 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. | |