org.jboss.netty.handler.codec.http

## 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:
  `HttpServerCodec`

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler

`ChannelHandler.Sharable`

### Constructor Summary

Constructors
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.

### Method Summary

Methods
`void` `handleDownstream(ChannelHandlerContext ctx, ChannelEvent e)` Handles the specified downstream event.
`void` `handleUpstream(ChannelHandlerContext ctx, ChannelEvent e)` Handles the specified upstream event.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### HttpClientCodec

    public HttpClientCodec()

Creates a new instance with the default decoder options (`maxInitialLineLength (4096`}, `maxHeaderSize (8192)`, and `maxChunkSize (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 Detail

#### handleUpstream

    public void handleUpstream(ChannelHandlerContext ctx,
                      ChannelEvent e)
                        throws Exception

Description copied from interface: `ChannelUpstreamHandler`
Handles the specified upstream event.

Specified by:
  `handleUpstream` in interface `ChannelUpstreamHandler`
Parameters:
  `ctx` - the context object for this handler
  `e` - the upstream event to process or intercept
Throws:
  `Exception`

#### handleDownstream

    public void handleDownstream(ChannelHandlerContext ctx,
                        ChannelEvent e)
                          throws Exception

Description copied from interface: `ChannelDownstreamHandler`
Handles the specified downstream event.

Specified by:
  `handleDownstream` in interface `ChannelDownstreamHandler`
Parameters:
  `ctx` - the context object for this handler
  `e` - the downstream event to process or intercept
Throws:
  `Exception`