Home / Class/ HttpObjectDecoder Class — netty Architecture

HttpObjectDecoder Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  6c551372_1bb2_fe27_3884_c4cc297c86ae["HttpObjectDecoder"]
  f15bbbf6_e315_8ba2_24a1_7970ea7b58eb["HttpObjectDecoder.java"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|defined in| f15bbbf6_e315_8ba2_24a1_7970ea7b58eb
  c2b60bb1_6e98_6428_ba15_c96af657eeaf["handlerRemoved0()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|method| c2b60bb1_6e98_6428_ba15_c96af657eeaf
  bd09ddb6_b37b_13c9_1e60_74dbe1e67a80["HttpObjectDecoder()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|method| bd09ddb6_b37b_13c9_1e60_74dbe1e67a80
  de7666f0_0485_6fa1_f7aa_fd49d59e9216["isValidating()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|method| de7666f0_0485_6fa1_f7aa_fd49d59e9216
  3a54a7e3_c206_fca7_1bb4_d8176ccd19cb["decode()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|method| 3a54a7e3_c206_fca7_1bb4_d8176ccd19cb
  ac7d1180_2220_c6a4_43ef_f0127601fbf9["decodeLast()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|method| ac7d1180_2220_c6a4_43ef_f0127601fbf9
  c741f03b_aff2_3a79_2718_b0aed95831c6["userEventTriggered()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|method| c741f03b_aff2_3a79_2718_b0aed95831c6
  9a2a7408_2b56_cc19_81fd_eb8bd8a25182["addCurrentMessage()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|method| 9a2a7408_2b56_cc19_81fd_eb8bd8a25182
  e296a6f9_cccf_f3cd_2a43_a9281d020f61["isContentAlwaysEmpty()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|method| e296a6f9_cccf_f3cd_2a43_a9281d020f61
  2f946e86_7691_de33_0f9b_17113f4e73f9["isSwitchingToNonHttp1Protocol()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|method| 2f946e86_7691_de33_0f9b_17113f4e73f9
  d68ab61e_c734_b4aa_bff2_feee406a43d8["reset()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|method| d68ab61e_c734_b4aa_bff2_feee406a43d8
  c3ede65f_ecbf_6fbd_c4d2_9a1fcb90c682["resetNow()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|method| c3ede65f_ecbf_6fbd_c4d2_9a1fcb90c682
  214afdc8_31d4_b0c6_2c07_ac9bac2c63b3["HttpMessage()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|method| 214afdc8_31d4_b0c6_2c07_ac9bac2c63b3
  f0688d6f_69a9_7904_5972_19bf1fc36adf["HttpContent()"]
  6c551372_1bb2_fe27_3884_c4cc297c86ae -->|method| f0688d6f_69a9_7904_5972_19bf1fc36adf

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java lines 146–1292

public abstract class HttpObjectDecoder extends ByteToMessageDecoder {
    public static final int DEFAULT_MAX_INITIAL_LINE_LENGTH = 4096;
    public static final int DEFAULT_MAX_HEADER_SIZE = 8192;
    public static final boolean DEFAULT_CHUNKED_SUPPORTED = true;
    public static final boolean DEFAULT_ALLOW_PARTIAL_CHUNKS = true;
    public static final int DEFAULT_MAX_CHUNK_SIZE = 8192;
    public static final boolean DEFAULT_VALIDATE_HEADERS = true;
    public static final int DEFAULT_INITIAL_BUFFER_SIZE = 128;
    public static final boolean DEFAULT_ALLOW_DUPLICATE_CONTENT_LENGTHS = false;
    public static final boolean DEFAULT_STRICT_LINE_PARSING =
            SystemPropertyUtil.getBoolean("io.netty.handler.codec.http.defaultStrictLineParsing", true);

    private static final Runnable THROW_INVALID_CHUNK_EXTENSION = new Runnable() {
        @Override
        public void run() {
            throw new InvalidChunkExtensionException();
        }
    };

    private static final Runnable THROW_INVALID_LINE_SEPARATOR = new Runnable() {
        @Override
        public void run() {
            throw new InvalidLineSeparatorException();
        }
    };

    private final int maxChunkSize;
    private final boolean chunkedSupported;
    private final boolean allowPartialChunks;
    /**
     * This field is no longer used. It is only kept around for backwards compatibility purpose.
     */
    @Deprecated
    protected final boolean validateHeaders;
    protected final HttpHeadersFactory headersFactory;
    protected final HttpHeadersFactory trailersFactory;
    private final boolean allowDuplicateContentLengths;
    private final ByteBuf parserScratchBuffer;
    private final Runnable defaultStrictCRLFCheck;
    private final HeaderParser headerParser;
    private final LineParser lineParser;

    private HttpMessage message;
    private long chunkSize;
    private long contentLength = Long.MIN_VALUE;
    private boolean chunked;
    private boolean isSwitchingToNonHttp1Protocol;

    private final AtomicBoolean resetRequested = new AtomicBoolean();

    // These will be updated by splitHeader(...)
    private AsciiString name;
    private String value;
    private LastHttpContent trailer;

    @Override
    protected void handlerRemoved0(ChannelHandlerContext ctx) throws Exception {
        try {
            parserScratchBuffer.release();
        } finally {
            super.handlerRemoved0(ctx);
        }
    }

    /**
     * The internal state of {@link HttpObjectDecoder}.
     * <em>Internal use only</em>.
     */
    private enum State {
        SKIP_CONTROL_CHARS,
        READ_INITIAL,
        READ_HEADER,
        READ_VARIABLE_LENGTH_CONTENT,
        READ_FIXED_LENGTH_CONTENT,
        READ_CHUNK_SIZE,
        READ_CHUNKED_CONTENT,
        READ_CHUNK_DELIMITER,
        READ_CHUNK_FOOTER,
        BAD_MESSAGE,
        UPGRADED
    }

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free