public final class HttpClientCodec extends CombinedChannelDuplexHandler<HttpResponseDecoder,HttpRequestEncoder> implements HttpClientUpgradeHandler.SourceCodec
HttpRequestEncoder
和HttpResponseDecoder
的组合,使客户端HTTP实现更容易。
HttpClientCodec
为HEAD和CONNECT请求提供了额外的状态管理,其中HttpResponseDecoder
缺少。
请参阅HttpResponseDecoder
以了解HEAD和CONNECT需要进行哪些额外的状态管理,以及为什么HttpResponseDecoder
无法自行处理。
如果Channel
已关闭并且没有响应, 则会引发PrematureChannelClosureException
。
HttpServerCodec
ChannelHandler.Sharable
Constructor and Description |
---|
HttpClientCodec()
使用默认解码器选项(
maxInitialLineLength (4096 },
maxHeaderSize (8192) 和
maxChunkSize (8192) )创建新实例。
|
HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize)
用指定的解码器选项创建一个新实例。
|
HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse)
用指定的解码器选项创建一个新实例。
|
HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders)
用指定的解码器选项创建一个新实例。
|
HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders, boolean parseHttpAfterConnectRequest)
用指定的解码器选项创建一个新实例。
|
HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize)
用指定的解码器选项创建一个新实例。
|
HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize, boolean parseHttpAfterConnectRequest)
用指定的解码器选项创建一个新实例。
|
Modifier and Type | Method and Description |
---|---|
boolean |
isSingleDecode() |
void |
prepareUpgradeFrom(ChannelHandlerContext ctx)
准备从HTTP升级到另一个协议。
|
void |
setSingleDecode(boolean singleDecode) |
void |
upgradeFrom(ChannelHandlerContext ctx)
从HTTP升级到另一个协议。
|
bind, channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, exceptionCaught, flush, handlerAdded, handlerRemoved, inboundHandler, init, outboundHandler, read, removeInboundHandler, removeOutboundHandler, userEventTriggered, write
ensureNotSharable, isSharable
public HttpClientCodec()
maxInitialLineLength (4096
},
maxHeaderSize (8192)
和
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 HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders, boolean parseHttpAfterConnectRequest)
public HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize)
public HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize, boolean parseHttpAfterConnectRequest)
public void prepareUpgradeFrom(ChannelHandlerContext ctx)
Encoder
。
prepareUpgradeFrom
在界面
HttpClientUpgradeHandler.SourceCodec
public void upgradeFrom(ChannelHandlerContext ctx)
Decoder
和Encoder
。
upgradeFrom
在界面
HttpClientUpgradeHandler.SourceCodec
public void setSingleDecode(boolean singleDecode)
public boolean isSingleDecode()
Copyright © 2008–2018 The Netty Project. All rights reserved.