Home / Class/ Http3 Class — netty Architecture

Http3 Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  62028209_7f48_6835_f4ab_ce7efbd616d8["Http3"]
  7021c2af_fb15_e651_5e3f_08acd93c2068["Http3.java"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|defined in| 7021c2af_fb15_e651_5e3f_08acd93c2068
  19e1f211_972a_b338_c6b3_400a0c21d3f8["Http3()"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|method| 19e1f211_972a_b338_c6b3_400a0c21d3f8
  42b44d45_bf87_42f5_136b_5248932fd638["QuicStreamChannel()"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|method| 42b44d45_bf87_42f5_136b_5248932fd638
  8851f7f5_03ef_3929_7bea_ef7057da5eb7["maxPushIdReceived()"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|method| 8851f7f5_03ef_3929_7bea_ef7057da5eb7
  d04101b2_c4b6_09b1_3b04_997b72ccd71b["setLocalControlStream()"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|method| d04101b2_c4b6_09b1_3b04_997b72ccd71b
  8e8d5107_9698_2d99_1cd6_8a0368f2208f["QpackAttributes()"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|method| 8e8d5107_9698_2d99_1cd6_8a0368f2208f
  0bc51643_527d_da50_d810_2fb5a54708b7["setQpackAttributes()"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|method| 0bc51643_527d_da50_d810_2fb5a54708b7
  e184ac63_2d88_f5fe_195e_1843c21543ba["newRequestStream()"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|method| e184ac63_2d88_f5fe_195e_1843c21543ba
  8ef1ecff_6097_6fd2_caea_617ecc8ba9bf["QuicStreamChannelBootstrap()"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|method| 8ef1ecff_6097_6fd2_caea_617ecc8ba9bf
  713f8ede_9893_4b7d_43db_64bb0f071f50["supportedApplicationProtocols()"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|method| 713f8ede_9893_4b7d_43db_64bb0f071f50
  39d0bf42_e037_5ef5_78fe_6a4fef73c9f7["QuicServerCodecBuilder()"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|method| 39d0bf42_e037_5ef5_78fe_6a4fef73c9f7
  480a2048_1f96_fb1f_166a_8f78b16298a5["QuicClientCodecBuilder()"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|method| 480a2048_1f96_fb1f_166a_8f78b16298a5
  33dfdcfa_ac0d_a971_fc28_42d937e8e514["T()"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|method| 33dfdcfa_ac0d_a971_fc28_42d937e8e514
  19aa098d_1b3b_5d08_6473_de7f69edddd6["Http3RequestStreamInitializer()"]
  62028209_7f48_6835_f4ab_ce7efbd616d8 -->|method| 19aa098d_1b3b_5d08_6473_de7f69edddd6

Relationship Graph

Source Code

codec-http3/src/main/java/io/netty/handler/codec/http3/Http3.java lines 34–179

public final class Http3 {

    private Http3() {  }

    private static final String[] H3_PROTOS = new String[] {
            "h3-29",
            "h3-30",
            "h3-31",
            "h3-32",
            "h3"
    };

    private static final AttributeKey<QuicStreamChannel> HTTP3_CONTROL_STREAM_KEY =
            AttributeKey.valueOf(Http3.class, "HTTP3ControlStream");

    private static final AttributeKey<QpackAttributes> QPACK_ATTRIBUTES_KEY =
            AttributeKey.valueOf(Http3.class, "QpackAttributes");

    /**
     * Returns the local initiated control stream for the HTTP/3 connection.
     * @param channel   the channel for the HTTP/3 connection.
     * @return          the control stream.
     */
    @Nullable
    public static QuicStreamChannel getLocalControlStream(Channel channel) {
        return channel.attr(HTTP3_CONTROL_STREAM_KEY).get();
    }

    /**
     * Returns the value of the <a
     * href="https://quicwg.org/base-drafts/draft-ietf-quic-http.html#name-max_push_id">max push ID</a> received for
     * this connection.
     *
     * @return Received <a
     * href="https://quicwg.org/base-drafts/draft-ietf-quic-http.html#name-max_push_id">max push ID</a> for this
     * connection.
     */
    static long maxPushIdReceived(QuicChannel channel) {
        final Http3ConnectionHandler connectionHandler = Http3CodecUtils.getConnectionHandlerOrClose(channel);
        if (connectionHandler == null) {
            throw new IllegalStateException("Connection handler not found.");
        }
        return connectionHandler.localControlStreamHandler.maxPushIdReceived();
    }

    static void setLocalControlStream(Channel channel, QuicStreamChannel controlStreamChannel) {
        channel.attr(HTTP3_CONTROL_STREAM_KEY).set(controlStreamChannel);
    }

    @Nullable
    static QpackAttributes getQpackAttributes(Channel channel) {
        return channel.attr(QPACK_ATTRIBUTES_KEY).get();
    }

    static void setQpackAttributes(Channel channel, QpackAttributes attributes) {
        channel.attr(QPACK_ATTRIBUTES_KEY).set(attributes);
    }

    /**
     * Returns a new HTTP/3 request-stream that will use the given {@link ChannelHandler}
     * to dispatch {@link Http3RequestStreamFrame}s too. The needed HTTP/3 codecs are automatically added to the
     * pipeline as well.
     *
     * If you need more control you can also use the {@link Http3RequestStreamInitializer} directly.
     *
     * @param channel   the {@link QuicChannel} for which we create the request-stream.
     * @param handler   the {@link ChannelHandler} to add.
     * @return          the {@link Future} that will be notified once the request-stream was opened.
     */
    public static Future<QuicStreamChannel> newRequestStream(QuicChannel channel, ChannelHandler handler) {
        return channel.createStream(QuicStreamType.BIDIRECTIONAL, requestStreamInitializer(handler));
    }

    /**
     * Returns a new HTTP/3 request-stream bootstrap that will use the given {@link ChannelHandler}
     * to dispatch {@link Http3RequestStreamFrame}s too. The needed HTTP/3 codecs are automatically added to the
     * pipeline as well.
     *
     * If you need more control you can also use the {@link Http3RequestStreamInitializer} directly.
     *
     * @param channel   the {@link QuicChannel} for which we create the request-stream.

Frequently Asked Questions

What is the Http3 class?
Http3 is a class in the netty codebase, defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3.java.
Where is Http3 defined?
Http3 is defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3.java at line 34.

Analyze Your Own Codebase

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

Try Supermodel Free