Home / Class/ HttpClientCodec Class — netty Architecture

HttpClientCodec Class — netty Architecture

Architecture documentation for the HttpClientCodec class in HttpClientCodec.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4f62e0d6_681d_cef7_f074_570eba4981bd["HttpClientCodec"]
  deb34d0e_cce7_d0ba_857f_8bfb8dcec181["HttpClientCodec.java"]
  4f62e0d6_681d_cef7_f074_570eba4981bd -->|defined in| deb34d0e_cce7_d0ba_857f_8bfb8dcec181
  c88b9dd1_ff3d_f7c4_ae5f_69d6733febe8["HttpClientCodec()"]
  4f62e0d6_681d_cef7_f074_570eba4981bd -->|method| c88b9dd1_ff3d_f7c4_ae5f_69d6733febe8
  d0e77006_488f_64b9_8a00_563dee195c37["prepareUpgradeFrom()"]
  4f62e0d6_681d_cef7_f074_570eba4981bd -->|method| d0e77006_488f_64b9_8a00_563dee195c37
  ead01b0b_fb08_f65e_589a_d8ae6ca999a8["upgradeFrom()"]
  4f62e0d6_681d_cef7_f074_570eba4981bd -->|method| ead01b0b_fb08_f65e_589a_d8ae6ca999a8
  20eed549_cf15_b0d1_6427_6b54ec7d4196["setSingleDecode()"]
  4f62e0d6_681d_cef7_f074_570eba4981bd -->|method| 20eed549_cf15_b0d1_6427_6b54ec7d4196
  ba5765ad_cd56_a515_fb82_268d160e10ff["isSingleDecode()"]
  4f62e0d6_681d_cef7_f074_570eba4981bd -->|method| ba5765ad_cd56_a515_fb82_268d160e10ff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpClientCodec.java lines 63–422

public final class HttpClientCodec extends CombinedChannelDuplexHandler<HttpResponseDecoder, HttpRequestEncoder>
        implements HttpClientUpgradeHandler.SourceCodec {
    public static final boolean DEFAULT_FAIL_ON_MISSING_RESPONSE = false;
    public static final boolean DEFAULT_PARSE_HTTP_AFTER_CONNECT_REQUEST = false;

    /** A queue that is used for correlating a request and a response. */
    private final Queue<HttpMethod> queue = new ArrayDeque<HttpMethod>();
    private final boolean parseHttpAfterConnectRequest;

    /** If true, decoding stops (i.e. pass-through) */
    private boolean done;

    private final AtomicLong requestResponseCounter = new AtomicLong();
    private final boolean failOnMissingResponse;

    /**
     * Creates a new instance with the default decoder options
     * ({@code maxInitialLineLength (4096)}, {@code maxHeaderSize (8192)}, and
     * {@code maxChunkSize (8192)}).
     */
    public HttpClientCodec() {
        this(new HttpDecoderConfig(),
                DEFAULT_PARSE_HTTP_AFTER_CONNECT_REQUEST,
                DEFAULT_FAIL_ON_MISSING_RESPONSE);
    }

    /**
     * Creates a new instance with the specified decoder options.
     */
    public HttpClientCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize) {
        this(new HttpDecoderConfig()
                        .setMaxInitialLineLength(maxInitialLineLength)
                        .setMaxHeaderSize(maxHeaderSize)
                        .setMaxChunkSize(maxChunkSize),
                DEFAULT_PARSE_HTTP_AFTER_CONNECT_REQUEST,
                DEFAULT_FAIL_ON_MISSING_RESPONSE);
    }

    /**
     * Creates a new instance with the specified decoder options.
     */
    public HttpClientCodec(
            int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse) {
        this(new HttpDecoderConfig()
                        .setMaxInitialLineLength(maxInitialLineLength)
                        .setMaxHeaderSize(maxHeaderSize)
                        .setMaxChunkSize(maxChunkSize),
                DEFAULT_PARSE_HTTP_AFTER_CONNECT_REQUEST,
                failOnMissingResponse);
    }

    /**
     * Creates a new instance with the specified decoder options.
     *
     * @deprecated Prefer the {@link #HttpClientCodec(int, int, int, boolean)} constructor,
     * to always enable header validation.
     */
    @Deprecated
    public HttpClientCodec(
            int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse,
            boolean validateHeaders) {
        this(new HttpDecoderConfig()
                        .setMaxInitialLineLength(maxInitialLineLength)
                        .setMaxHeaderSize(maxHeaderSize)
                        .setMaxChunkSize(maxChunkSize)
                        .setValidateHeaders(validateHeaders),
                DEFAULT_PARSE_HTTP_AFTER_CONNECT_REQUEST,
                failOnMissingResponse);
    }

    /**
     * Creates a new instance with the specified decoder options.
     *
     * @deprecated Prefer the {@link #HttpClientCodec(HttpDecoderConfig, boolean, boolean)} constructor,
     * to always enable header validation.
     */
    @Deprecated
    public HttpClientCodec(
            int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean failOnMissingResponse,
            boolean validateHeaders, boolean parseHttpAfterConnectRequest) {
        this(new HttpDecoderConfig()

Frequently Asked Questions

What is the HttpClientCodec class?
HttpClientCodec is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpClientCodec.java.
Where is HttpClientCodec defined?
HttpClientCodec is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpClientCodec.java at line 63.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free