HttpRequestEncoder and HttpResponseDecoder
which enables easier client side HTTP implementation. HttpClientCodec
provides additional state management for HEAD and CONNECT
requests, which HttpResponseDecoder lacks. Please refer to
HttpResponseDecoder to learn what additional state management needs
to be done for HEAD and CONNECT and why
HttpResponseDecoder can not handle it by itself.
If the Channel is closed and there are missing responses,
a PrematureChannelClosureException is thrown.
HttpServerCodec
| Modifier and Type | Class and Description |
|---|---|
| private class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| public static final boolean | |
| public static final boolean | |
| private boolean | done
If true, decoding stops (i.e. pass-through) |
| private final boolean | |
| private final boolean | |
| private final Queue | queue
A queue that is used for correlating a request and a response. |
| private final AtomicLong |
| Access | Constructor and Description |
|---|---|
| public | HttpClientCodec()
Creates a new instance with the default decoder options
( |
| public | HttpClientCodec(int maxInitialLineLength, int maxHeaderSize)
Creates a new instance with the specified decoder options. |
| public | HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, boolean failOnMissingResponse)
Creates a new instance with the specified decoder options. |
| public | HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, boolean failOnMissingResponse, boolean validateHeaders)
Creates a new instance with the specified decoder options. |
| public | HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, boolean failOnMissingResponse, boolean validateHeaders, boolean parseHttpAfterConnectRequest)
Creates a new instance with the specified decoder options. |
| public | HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize)
Creates a new instance with the specified decoder options. |
| public | HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize, boolean parseHttpAfterConnectRequest)
Creates a new instance with the specified decoder options. |
| public | HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize, boolean parseHttpAfterConnectRequest, boolean allowDuplicateContentLengths)
Creates a new instance with the specified decoder options. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public void | prepareUpgradeFrom(ChannelHandlerContext ctx)
Implements io. |
| public void | |
| public void | upgradeFrom(ChannelHandlerContext ctx)
Implements io. |
| DEFAULT_FAIL_ON_MISSING_RESPONSE | back to summary |
|---|---|
| public static final boolean DEFAULT_FAIL_ON_MISSING_RESPONSE | |
| DEFAULT_PARSE_HTTP_AFTER_CONNECT_REQUEST | back to summary |
|---|---|
| public static final boolean DEFAULT_PARSE_HTTP_AFTER_CONNECT_REQUEST | |
| done | back to summary |
|---|---|
| private boolean done If true, decoding stops (i.e. pass-through) | |
| failOnMissingResponse | back to summary |
|---|---|
| private final boolean failOnMissingResponse | |
| parseHttpAfterConnectRequest | back to summary |
|---|---|
| private final boolean parseHttpAfterConnectRequest | |
| queue | back to summary |
|---|---|
| private final Queue<HttpMethod> queue A queue that is used for correlating a request and a response. | |
| requestResponseCounter | back to summary |
|---|---|
| private final AtomicLong requestResponseCounter | |
| HttpClientCodec | back to summary |
|---|---|
| public HttpClientCodec() Creates a new instance with the default decoder options
( | |
| HttpClientCodec | back to summary |
|---|---|
| public HttpClientCodec(int maxInitialLineLength, int maxHeaderSize) Creates a new instance with the specified decoder options. | |
| HttpClientCodec | back to summary |
|---|---|
| public HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, boolean failOnMissingResponse) Creates a new instance with the specified decoder options. | |
| HttpClientCodec | back to summary |
|---|---|
| public HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, boolean failOnMissingResponse, boolean validateHeaders) Creates a new instance with the specified decoder options. | |
| HttpClientCodec | back to summary |
|---|---|
| public HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, boolean failOnMissingResponse, boolean validateHeaders, boolean parseHttpAfterConnectRequest) Creates a new instance with the specified decoder options. | |
| HttpClientCodec | back to summary |
|---|---|
| public HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize) Creates a new instance with the specified decoder options. | |
| HttpClientCodec | back to summary |
|---|---|
| public HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize, boolean parseHttpAfterConnectRequest) Creates a new instance with the specified decoder options. | |
| HttpClientCodec | back to summary |
|---|---|
| public HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize, boolean parseHttpAfterConnectRequest, boolean allowDuplicateContentLengths) Creates a new instance with the specified decoder options. | |
| isSingleDecode | back to summary |
|---|---|
| public boolean isSingleDecode() | |
| prepareUpgradeFrom | back to summary |
|---|---|
| public void prepareUpgradeFrom(ChannelHandlerContext ctx) Implements io. Prepares to upgrade to another protocol from HTTP. Disables the
| |
| setSingleDecode | back to summary |
|---|---|
| public void setSingleDecode(boolean singleDecode) | |
| upgradeFrom | back to summary |
|---|---|
| public void upgradeFrom(ChannelHandlerContext ctx) Implements io. Upgrades to another protocol from HTTP. Removes the
| |
| Modifier and Type | Field and Description |
|---|---|
| private ChannelHandlerContext |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv | Decoder(int maxInitialLineLength, int maxHeaderSize, boolean validateHeaders, int initialBufferSize, boolean allowDuplicateContentLengths)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | channelInactive(ChannelHandlerContext ctx)
Overrides io. Overrides default io. Channel of the ChannelHandlerContext was registered is now inactive and reached its
end of lifetime.
|
| protected void | decode(ChannelHandlerContext
the ctx, Buffer ChannelHandlerContext which this ByteToMessageDecoder belongs tothe buffer)Buffer from which to read dataOverrides io. Buffer to another.
|
| private void | |
| protected void | |
| protected boolean |
| context | back to summary |
|---|---|
| private ChannelHandlerContext context | |
| Decoder | back to summary |
|---|---|
| pack-priv Decoder(int maxInitialLineLength, int maxHeaderSize, boolean validateHeaders) | |
| Decoder | back to summary |
|---|---|
| pack-priv Decoder(int maxInitialLineLength, int maxHeaderSize, boolean validateHeaders, int initialBufferSize, boolean allowDuplicateContentLengths) | |
| channelInactive | back to summary |
|---|---|
| public void channelInactive(ChannelHandlerContext ctx) throws Exception Overrides io. Overrides default io. Doc from io. The
| |
| decode | back to summary |
|---|---|
| protected void decode(ChannelHandlerContext ctx, Buffer buffer) throws Exception Overrides io. Doc from io. Decode the from one
| |
| decrement | back to summary |
|---|---|
| private void decrement(Object msg) | |
| handlerAdded0 | back to summary |
|---|---|
| protected void handlerAdded0(ChannelHandlerContext ctx) Overrides io.
| |
| isContentAlwaysEmpty | back to summary |
|---|---|
| protected boolean isContentAlwaysEmpty(HttpMessage msg) Overrides io.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv boolean |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected void | encodeAndClose(ChannelHandlerContext
the ctx, Object ChannelHandlerContext which this MessageToMessageEncoder belongs to.the message to encode to another one. msg, List<Object> the out)List into which produced output messages should be added.Overrides io. |
| upgraded | back to summary |
|---|---|
| pack-priv boolean upgraded | |
| Encoder | back to summary |
|---|---|
| private Encoder() | |
| encodeAndClose | back to summary |
|---|---|
| protected void encodeAndClose(ChannelHandlerContext ctx, Object msg, List<Object> out) throws Exception Overrides io. Doc from io. Encode from one message to another. This method will be called for each written message that can be handled by this encoder. The message will not be automatically disposed of after this call. Instead, the responsibility of ensuring that messages are disposed of falls upon the implementor of this method.
Subclasses that wish to have incoming messages automatically disposed of should instead override the
| |