Home / Class/ HttpServerCodec Class — netty Architecture

HttpServerCodec Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  bf081120_ce91_bdb4_0b59_151022060192["HttpServerCodec"]
  9ed88c87_197e_6fb8_dd21_8f9a0fe69fa7["HttpServerCodec.java"]
  bf081120_ce91_bdb4_0b59_151022060192 -->|defined in| 9ed88c87_197e_6fb8_dd21_8f9a0fe69fa7
  e8bfa366_abd8_49d0_e8a0_0335cc203967["HttpServerCodec()"]
  bf081120_ce91_bdb4_0b59_151022060192 -->|method| e8bfa366_abd8_49d0_e8a0_0335cc203967
  77ce02f2_1997_bed8_d9f7_288e5185611f["upgradeFrom()"]
  bf081120_ce91_bdb4_0b59_151022060192 -->|method| 77ce02f2_1997_bed8_d9f7_288e5185611f

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpServerCodec.java lines 49–201

public final class HttpServerCodec extends CombinedChannelDuplexHandler<HttpRequestDecoder, HttpResponseEncoder>
        implements HttpServerUpgradeHandler.SourceCodec {

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

    /**
     * Creates a new instance with the default decoder options
     * ({@code maxInitialLineLength (4096)}, {@code maxHeaderSize (8192)}, and
     * {@code maxChunkSize (8192)}).
     */
    public HttpServerCodec() {
        this(DEFAULT_MAX_INITIAL_LINE_LENGTH, DEFAULT_MAX_HEADER_SIZE, DEFAULT_MAX_CHUNK_SIZE);
    }

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

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

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

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

    /**
     * Creates a new instance with the specified decoder options.
     *
     * @deprecated Prefer the {@link #HttpServerCodec(HttpDecoderConfig)} constructor,
     * to always enable header validation.
     */

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free