public final class HttpClientCodec extends ChannelHandlerAppender implements HttpClientUpgradeHandler.SourceCodec
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.HttpServerCodecChannelHandler.Sharable, ChannelHandler.Skip| Constructor and Description |
|---|
HttpClientCodec()
Creates a new instance with the default decoder options
(
maxInitialLineLength (4096}, maxHeaderSize (8192), and
maxChunkSize (8192)). |
HttpClientCodec(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize)
Creates a new instance with the specified decoder options.
|
HttpClientCodec(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean failOnMissingResponse)
Creates a new instance with the specified decoder options.
|
HttpClientCodec(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean failOnMissingResponse,
boolean validateHeaders)
Creates a new instance with the specified decoder options.
|
| Modifier and Type | Method and Description |
|---|---|
HttpResponseDecoder |
decoder()
Returns the decoder of this codec.
|
HttpRequestEncoder |
encoder()
Returns the encoder of this codec.
|
boolean |
isSingleDecode() |
void |
setSingleDecode(boolean singleDecode) |
void |
upgradeFrom(ChannelHandlerContext ctx)
Upgrades to another protocol from HTTP.
|
add, add, add, add, handlerAdded, handlerAtbind, channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, exceptionCaught, flush, handlerRemoved, isSharable, read, userEventTriggered, writepublic HttpClientCodec()
maxInitialLineLength (4096}, maxHeaderSize (8192), and
maxChunkSize (8192)).public HttpClientCodec(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize)
public HttpClientCodec(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean failOnMissingResponse)
public HttpClientCodec(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean failOnMissingResponse,
boolean validateHeaders)
public void upgradeFrom(ChannelHandlerContext ctx)
Decoder and Encoder from
the pipeline.upgradeFrom in interface HttpClientUpgradeHandler.SourceCodecpublic HttpRequestEncoder encoder()
public HttpResponseDecoder decoder()
public void setSingleDecode(boolean singleDecode)
public boolean isSingleDecode()
Copyright © 2008–2015 The Netty Project. All rights reserved.