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 ofHttpRequestEncoder
andBasicHttpResponseDecoder
which enables easier client side HTTP implementation.HttpClientCodec
provides additional state management for HEAD and CONNECT requests, whichBasicHttpResponseDecoder
lacks. Please refer toBasicHttpResponseDecoder
to learn what additional state management needs to be done for HEAD and CONNECT and whyBasicHttpResponseDecoder
can not handle it by itself. If theChannel
is closed and there are missing responses, aPrematureChannelClosureException
is 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 boolean
isSingleDecode()
void
prepareUpgradeFrom(io.netty.channel.ChannelHandlerContext ctx)
Prepares to upgrade to another protocol from HTTP.void
setSingleDecode(boolean singleDecode)
void
upgradeFrom(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:
prepareUpgradeFrom
in 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 andHttpRequestEncoder
from the pipeline.- Specified by:
upgradeFrom
in interfaceio.netty.handler.codec.http.HttpClientUpgradeHandler.SourceCodec
-
setSingleDecode
public void setSingleDecode(boolean singleDecode)
-
isSingleDecode
public boolean isSingleDecode()
-
-