Class HttpClientCodec
java.lang.Object
org.jboss.netty.handler.codec.http.HttpClientCodec
- All Implemented Interfaces:
ChannelDownstreamHandler, ChannelHandler, ChannelUpstreamHandler
public class HttpClientCodec
extends Object
implements ChannelUpstreamHandler, ChannelDownstreamHandler
A combination of
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 gets closed and there are requests missing for a response
a PrematureChannelClosureException is thrown.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classprivate final classNested classes/interfaces inherited from interface ChannelHandler
ChannelHandler.Sharable -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HttpResponseDecoder(package private) booleanIf true, decoding stops (i.e.private final HttpRequestEncoderprivate final boolean(package private) final Queue<HttpMethod> A queue that is used for correlating a request and a response.private final AtomicLong -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance with the default decoder options (maxInitialLineLength (4096},maxHeaderSize (8192), andmaxChunkSize (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. -
Method Summary
Modifier and TypeMethodDescriptionvoidHandles the specified downstream event.voidHandles the specified upstream event.
-
Field Details
-
queue
A queue that is used for correlating a request and a response. -
done
volatile boolean doneIf true, decoding stops (i.e. pass-through) -
encoder
-
decoder
-
requestResponseCounter
-
failOnMissingResponse
private final boolean failOnMissingResponse
-
-
Constructor Details
-
HttpClientCodec
public HttpClientCodec()Creates a new instance with the default decoder options (maxInitialLineLength (4096},maxHeaderSize (8192), andmaxChunkSize (8192)). -
HttpClientCodec
public HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize) Creates a new instance with the specified decoder options. -
HttpClientCodec
public HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse) Creates a new instance with the specified decoder options.
-
-
Method Details
-
handleUpstream
Description copied from interface:ChannelUpstreamHandlerHandles the specified upstream event.- Specified by:
handleUpstreamin interfaceChannelUpstreamHandler- Parameters:
ctx- the context object for this handlere- the upstream event to process or intercept- Throws:
Exception
-
handleDownstream
Description copied from interface:ChannelDownstreamHandlerHandles the specified downstream event.- Specified by:
handleDownstreamin interfaceChannelDownstreamHandler- Parameters:
ctx- the context object for this handlere- the downstream event to process or intercept- Throws:
Exception
-