Class BasicHttpClientCodec
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.ChannelDuplexHandler
-
- io.netty.channel.CombinedChannelDuplexHandler<BasicHttpResponseDecoder,io.netty.handler.codec.http.HttpRequestEncoder>
-
- com.linkedin.alpini.netty4.handlers.BasicHttpClientCodec
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler,io.netty.channel.ChannelOutboundHandler,io.netty.handler.codec.http.HttpClientUpgradeHandler.SourceCodec
public final class BasicHttpClientCodec extends io.netty.channel.CombinedChannelDuplexHandler<BasicHttpResponseDecoder,io.netty.handler.codec.http.HttpRequestEncoder> implements io.netty.handler.codec.http.HttpClientUpgradeHandler.SourceCodec
A combination ofHttpRequestEncoderandBasicHttpResponseDecoderwhich enables easier client side HTTP implementation.HttpClientCodecprovides additional state management for HEAD and CONNECT requests, whichBasicHttpResponseDecoderlacks. Please refer toBasicHttpResponseDecoderto learn what additional state management needs to be done for HEAD and CONNECT and whyBasicHttpResponseDecodercan not handle it by itself. If theChannelis closed and there are missing responses, aPrematureChannelClosureExceptionis thrown.- See Also:
BasicHttpServerCodec
-
-
Constructor Summary
Constructors Constructor Description BasicHttpClientCodec()Creates a new instance with the default decoder options (maxInitialLineLength (4096},maxHeaderSize (8192), andmaxChunkSize (8192)).BasicHttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize)Creates a new instance with the specified decoder options.BasicHttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse)Creates a new instance with the specified decoder options.BasicHttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders)Creates a new instance with the specified decoder options.BasicHttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders, boolean parseHttpAfterConnectRequest)Creates a new instance with the specified decoder options.BasicHttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize)Creates a new instance with the specified decoder options.BasicHttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize, boolean parseHttpAfterConnectRequest)Creates a new instance with the specified decoder options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisSingleDecode()voidprepareUpgradeFrom(io.netty.channel.ChannelHandlerContext ctx)Prepares to upgrade to another protocol from HTTP.voidsetSingleDecode(boolean singleDecode)voidupgradeFrom(io.netty.channel.ChannelHandlerContext ctx)Upgrades to another protocol from HTTP.-
Methods inherited from class io.netty.channel.CombinedChannelDuplexHandler
bind, channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, exceptionCaught, flush, handlerAdded, handlerRemoved, inboundHandler, init, outboundHandler, read, removeInboundHandler, removeOutboundHandler, userEventTriggered, write
-
-
-
-
Constructor Detail
-
BasicHttpClientCodec
public BasicHttpClientCodec()
Creates a new instance with the default decoder options (maxInitialLineLength (4096},maxHeaderSize (8192), andmaxChunkSize (8192)).
-
BasicHttpClientCodec
public BasicHttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize)Creates a new instance with the specified decoder options.
-
BasicHttpClientCodec
public BasicHttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse)Creates a new instance with the specified decoder options.
-
BasicHttpClientCodec
public BasicHttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders)Creates a new instance with the specified decoder options.
-
BasicHttpClientCodec
public BasicHttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders, boolean parseHttpAfterConnectRequest)Creates a new instance with the specified decoder options.
-
BasicHttpClientCodec
public BasicHttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize)Creates a new instance with the specified decoder options.
-
BasicHttpClientCodec
public BasicHttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse, boolean validateHeaders, int initialBufferSize, boolean parseHttpAfterConnectRequest)Creates a new instance with the specified decoder options.
-
-
Method Detail
-
prepareUpgradeFrom
public void prepareUpgradeFrom(io.netty.channel.ChannelHandlerContext ctx)
Prepares to upgrade to another protocol from HTTP. Disables theHttpRequestEncoder.- Specified by:
prepareUpgradeFromin interfaceio.netty.handler.codec.http.HttpClientUpgradeHandler.SourceCodec
-
upgradeFrom
public void upgradeFrom(io.netty.channel.ChannelHandlerContext ctx)
Upgrades to another protocol from HTTP. Removes the BasicHttpResponseDecoder andHttpRequestEncoderfrom the pipeline.- Specified by:
upgradeFromin interfaceio.netty.handler.codec.http.HttpClientUpgradeHandler.SourceCodec
-
setSingleDecode
public void setSingleDecode(boolean singleDecode)
-
isSingleDecode
public boolean isSingleDecode()
-
-