Home / Class/ DefaultHttp2FrameReader Class — netty Architecture

DefaultHttp2FrameReader Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  3768d640_58c2_34e7_3d69_a4b578e0d11a["DefaultHttp2FrameReader"]
  bd6b4c97_c25c_eb7e_f217_235e361db864["DefaultHttp2FrameReader.java"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|defined in| bd6b4c97_c25c_eb7e_f217_235e361db864
  efb85803_73d8_1729_a21f_9c6d3a97c914["DefaultHttp2FrameReader()"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|method| efb85803_73d8_1729_a21f_9c6d3a97c914
  e936abcc_d43e_0d0a_03e1_cb01db290e55["headersConfiguration()"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|method| e936abcc_d43e_0d0a_03e1_cb01db290e55
  aa27e754_524f_61bb_5957_d416cff12aed["Configuration()"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|method| aa27e754_524f_61bb_5957_d416cff12aed
  161021a6_5427_f64c_99e4_96c193e1fb6e["Http2FrameSizePolicy()"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|method| 161021a6_5427_f64c_99e4_96c193e1fb6e
  3aff8823_71da_4119_d96e_f3cdf9d1fa40["maxFrameSize()"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|method| 3aff8823_71da_4119_d96e_f3cdf9d1fa40
  3817d9d0_3adc_b8a2_82ef_2347cad8b4de["close()"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|method| 3817d9d0_3adc_b8a2_82ef_2347cad8b4de
  fbe3de1b_cfa5_5c55_06b0_8b5f5a5ea490["closeHeadersContinuation()"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|method| fbe3de1b_cfa5_5c55_06b0_8b5f5a5ea490
  f53e0d0e_4159_3b85_497b_bc55cfb15681["readFrame()"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|method| f53e0d0e_4159_3b85_497b_bc55cfb15681
  969e7b9f_005c_0301_2983_56e986f1d510["preProcessFrame()"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|method| 969e7b9f_005c_0301_2983_56e986f1d510
  80aaad85_d41e_97a8_6671_ac352891e88f["verifyFrameState()"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|method| 80aaad85_d41e_97a8_6671_ac352891e88f
  e711693c_32ed_ac69_29f1_ce5694750979["processPayloadState()"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|method| e711693c_32ed_ac69_29f1_ce5694750979
  ff0a6525_ffe7_173c_fcc2_b84f2787a291["verifyDataFrame()"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|method| ff0a6525_ffe7_173c_fcc2_b84f2787a291
  c3b18a68_fb1e_a250_383c_d5326174d526["verifyHeadersFrame()"]
  3768d640_58c2_34e7_3d69_a4b578e0d11a -->|method| c3b18a68_fb1e_a250_383c_d5326174d526

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameReader.java lines 53–775

public class DefaultHttp2FrameReader implements Http2FrameReader, Http2FrameSizePolicy, Configuration {
    private final Http2HeadersDecoder headersDecoder;

    /**
     * {@code true} = reading headers, {@code false} = reading payload.
     */
    private boolean readingHeaders = true;
    /**
     * Once set to {@code true} the value will never change. This is set to {@code true} if an unrecoverable error which
     * renders the connection unusable.
     */
    private boolean readError;
    private byte frameType;
    private int streamId;
    private Http2Flags flags;
    private int payloadLength;
    private HeadersContinuation headersContinuation;
    private int maxFrameSize;

    /**
     * Create a new instance.
     * <p>
     * Header names will be validated.
     */
    public DefaultHttp2FrameReader() {
        this(true);
    }

    /**
     * Create a new instance.
     * @param validateHeaders {@code true} to validate headers. {@code false} to not validate headers.
     * @see DefaultHttp2HeadersDecoder(boolean)
     */
    public DefaultHttp2FrameReader(boolean validateHeaders) {
        this(new DefaultHttp2HeadersDecoder(validateHeaders));
    }

    public DefaultHttp2FrameReader(Http2HeadersDecoder headersDecoder) {
        this.headersDecoder = headersDecoder;
        maxFrameSize = DEFAULT_MAX_FRAME_SIZE;
    }

    @Override
    public Http2HeadersDecoder.Configuration headersConfiguration() {
        return headersDecoder.configuration();
    }

    @Override
    public Configuration configuration() {
        return this;
    }

    @Override
    public Http2FrameSizePolicy frameSizePolicy() {
        return this;
    }

    @Override
    public void maxFrameSize(int max) throws Http2Exception {
        if (!isMaxFrameSizeValid(max)) {
            // SETTINGS frames affect the entire connection state and thus errors must be connection errors.
            // See https://datatracker.ietf.org/doc/html/rfc9113#section-4.2 for details.
            throw connectionError(FRAME_SIZE_ERROR, "Invalid MAX_FRAME_SIZE specified in sent settings: %d", max);
        }
        maxFrameSize = max;
    }

    @Override
    public int maxFrameSize() {
        return maxFrameSize;
    }

    @Override
    public void close() {
        closeHeadersContinuation();
    }

    private void closeHeadersContinuation() {
        if (headersContinuation != null) {
            headersContinuation.close();
            headersContinuation = null;

Frequently Asked Questions

What is the DefaultHttp2FrameReader class?
DefaultHttp2FrameReader is a class in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameReader.java.
Where is DefaultHttp2FrameReader defined?
DefaultHttp2FrameReader is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameReader.java at line 53.

Analyze Your Own Codebase

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

Try Supermodel Free