Home / Class/ DefaultHttp2FrameWriter Class — netty Architecture

DefaultHttp2FrameWriter Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  15f148d0_1b4a_244f_1956_157fbe75e59a["DefaultHttp2FrameWriter"]
  24e0ce6e_591d_3f87_60cc_6dfa10494d7d["DefaultHttp2FrameWriter.java"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|defined in| 24e0ce6e_591d_3f87_60cc_6dfa10494d7d
  769077a5_799c_1b47_a985_fbadea2d51ac["DefaultHttp2FrameWriter()"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|method| 769077a5_799c_1b47_a985_fbadea2d51ac
  a57e8004_69a3_a56f_9606_1f59da558086["Configuration()"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|method| a57e8004_69a3_a56f_9606_1f59da558086
  5dc0499a_9a42_bfcd_7a94_8b871cbc408a["headersConfiguration()"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|method| 5dc0499a_9a42_bfcd_7a94_8b871cbc408a
  f58777af_1757_73ee_7ca9_63b2cb9b3bff["Http2FrameSizePolicy()"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|method| f58777af_1757_73ee_7ca9_63b2cb9b3bff
  fad01a13_0db8_3ab3_4f7e_c826b9f133d2["maxFrameSize()"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|method| fad01a13_0db8_3ab3_4f7e_c826b9f133d2
  0890bb09_a1b4_43d6_d14e_53340e0bd364["close()"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|method| 0890bb09_a1b4_43d6_d14e_53340e0bd364
  fe7bfdb5_730f_310a_cec0_582ba7362f95["ChannelFuture()"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|method| fe7bfdb5_730f_310a_cec0_582ba7362f95
  6a049d1f_c405_e97a_f598_c0b1f527f8b4["paddingBytes()"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|method| 6a049d1f_c405_e97a_f598_c0b1f527f8b4
  3c7062cb_c10f_46c2_78ff_fad8e19f9d1a["writePaddingLength()"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|method| 3c7062cb_c10f_46c2_78ff_fad8e19f9d1a
  70c16ebc_c549_d265_0be2_1f4c7cb8e813["verifyStreamId()"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|method| 70c16ebc_c549_d265_0be2_1f4c7cb8e813
  081b2510_ce8a_a65a_45d1_06400c5c5adf["verifyStreamOrConnectionId()"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|method| 081b2510_ce8a_a65a_45d1_06400c5c5adf
  2082dc42_7809_f8bc_b329_9ff15dc486ce["verifyWeight()"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|method| 2082dc42_7809_f8bc_b329_9ff15dc486ce
  3f586cd7_0e4c_cc62_3d7d_314fc6116b36["verifyErrorCode()"]
  15f148d0_1b4a_244f_1956_157fbe75e59a -->|method| 3f586cd7_0e4c_cc62_3d7d_314fc6116b36

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/DefaultHttp2FrameWriter.java lines 74–643

public class DefaultHttp2FrameWriter implements Http2FrameWriter, Http2FrameSizePolicy, Configuration {
    private static final String STREAM_ID = "Stream ID";
    private static final String STREAM_DEPENDENCY = "Stream Dependency";
    /**
     * This buffer is allocated to the maximum size of the padding field, and filled with zeros.
     * When padding is needed it can be taken as a slice of this buffer. Users should call {@link ByteBuf#retain()}
     * before using their slice.
     */
    private static final ByteBuf ZERO_BUFFER = LeakPresenceDetector.staticInitializer(() ->
            unreleasableBuffer(directBuffer(MAX_UNSIGNED_BYTE).writeZero(MAX_UNSIGNED_BYTE)).asReadOnly());

    private final Http2HeadersEncoder headersEncoder;
    private int maxFrameSize;

    public DefaultHttp2FrameWriter() {
        this(new DefaultHttp2HeadersEncoder());
    }

    public DefaultHttp2FrameWriter(SensitivityDetector headersSensitivityDetector) {
        this(new DefaultHttp2HeadersEncoder(headersSensitivityDetector));
    }

    public DefaultHttp2FrameWriter(SensitivityDetector headersSensitivityDetector, boolean ignoreMaxHeaderListSize) {
        this(new DefaultHttp2HeadersEncoder(headersSensitivityDetector, ignoreMaxHeaderListSize));
    }

    /**
     * @param headersEncoder will be closed if it implements {@link Closeable}
     */
    public DefaultHttp2FrameWriter(Http2HeadersEncoder headersEncoder) {
        this.headersEncoder = headersEncoder;
        maxFrameSize = DEFAULT_MAX_FRAME_SIZE;
    }

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

    @Override
    public Http2HeadersEncoder.Configuration headersConfiguration() {
        return headersEncoder.configuration();
    }

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

    @Override
    public void maxFrameSize(int max) throws Http2Exception {
        if (!isMaxFrameSizeValid(max)) {
            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() {
        if (headersEncoder instanceof Closeable) {
            try {
                ((Closeable) headersEncoder).close();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }

    @Override
    public ChannelFuture writeData(ChannelHandlerContext ctx, int streamId, ByteBuf data,
            int padding, boolean endStream, ChannelPromise promise) {
        final SimpleChannelPromiseAggregator promiseAggregator =
                new SimpleChannelPromiseAggregator(promise, ctx.channel(), ctx.executor());
        ByteBuf frameHeader = null;
        try {
            verifyStreamId(streamId, STREAM_ID);

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free