Home / Class/ Http3UnidirectionalStreamInboundHandler Class — netty Architecture

Http3UnidirectionalStreamInboundHandler Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  36d5bd43_dd1d_08a7_bad2_6e9b8c3d046d["Http3UnidirectionalStreamInboundHandler"]
  bc398994_1d37_afa1_dd0c_6bbc5aded041["Http3UnidirectionalStreamInboundHandler.java"]
  36d5bd43_dd1d_08a7_bad2_6e9b8c3d046d -->|defined in| bc398994_1d37_afa1_dd0c_6bbc5aded041
  6f49b086_4496_64c5_f1f3_2723b39ac1a8["Http3UnidirectionalStreamInboundHandler()"]
  36d5bd43_dd1d_08a7_bad2_6e9b8c3d046d -->|method| 6f49b086_4496_64c5_f1f3_2723b39ac1a8
  1b08c453_9a02_86bf_622f_7896be128c86["decode()"]
  36d5bd43_dd1d_08a7_bad2_6e9b8c3d046d -->|method| 1b08c453_9a02_86bf_622f_7896be128c86
  44f4bc70_6564_439a_fc6c_13e2b47ed10f["initControlStream()"]
  36d5bd43_dd1d_08a7_bad2_6e9b8c3d046d -->|method| 44f4bc70_6564_439a_fc6c_13e2b47ed10f
  3599d1e6_1570_a5a7_22a9_7072d955db2b["ensureStreamNotExistsYet()"]
  36d5bd43_dd1d_08a7_bad2_6e9b8c3d046d -->|method| 3599d1e6_1570_a5a7_22a9_7072d955db2b
  5892c0b7_f8b1_d31b_666e_fb19c1fab403["initPushStream()"]
  36d5bd43_dd1d_08a7_bad2_6e9b8c3d046d -->|method| 5892c0b7_f8b1_d31b_666e_fb19c1fab403
  d7833d8a_8a2d_e883_0d83_3de1cb9f5c7d["initQpackEncoderStream()"]
  36d5bd43_dd1d_08a7_bad2_6e9b8c3d046d -->|method| d7833d8a_8a2d_e883_0d83_3de1cb9f5c7d
  b02a352c_a34c_9982_b1be_a2c6474d8c7a["initQpackDecoderStream()"]
  36d5bd43_dd1d_08a7_bad2_6e9b8c3d046d -->|method| b02a352c_a34c_9982_b1be_a2c6474d8c7a
  34b83b51_8921_70c5_8498_259b5e7aa1c1["initUnknownStream()"]
  36d5bd43_dd1d_08a7_bad2_6e9b8c3d046d -->|method| 34b83b51_8921_70c5_8498_259b5e7aa1c1

Relationship Graph

Source Code

codec-http3/src/main/java/io/netty/handler/codec/http3/Http3UnidirectionalStreamInboundHandler.java lines 43–196

abstract class Http3UnidirectionalStreamInboundHandler extends ByteToMessageDecoder {
    private static final AttributeKey<Boolean> REMOTE_CONTROL_STREAM = AttributeKey.valueOf("H3_REMOTE_CONTROL_STREAM");
    private static final AttributeKey<Boolean> REMOTE_QPACK_DECODER_STREAM =
            AttributeKey.valueOf("H3_REMOTE_QPACK_DECODER_STREAM");
    private static final AttributeKey<Boolean> REMOTE_QPACK_ENCODER_STREAM =
            AttributeKey.valueOf("H3_REMOTE_QPACK_ENCODER_STREAM");

    final Http3FrameCodecFactory codecFactory;
    final NonStandardHttp3SettingsValidator nonStandardSettingsValidator;
    final Http3ControlStreamInboundHandler localControlStreamHandler;
    final Http3ControlStreamOutboundHandler remoteControlStreamHandler;
    final Supplier<ChannelHandler> qpackEncoderHandlerFactory;
    final Supplier<ChannelHandler> qpackDecoderHandlerFactory;
    final LongFunction<ChannelHandler> unknownStreamHandlerFactory;

    Http3UnidirectionalStreamInboundHandler(Http3FrameCodecFactory codecFactory,
                                            NonStandardHttp3SettingsValidator nonStandardSettingsValidator,
                                            Http3ControlStreamInboundHandler localControlStreamHandler,
                                            Http3ControlStreamOutboundHandler remoteControlStreamHandler,
                                            @Nullable LongFunction<ChannelHandler> unknownStreamHandlerFactory,
                                            Supplier<ChannelHandler> qpackEncoderHandlerFactory,
                                            Supplier<ChannelHandler> qpackDecoderHandlerFactory) {
        this.codecFactory = codecFactory;
        this.nonStandardSettingsValidator = nonStandardSettingsValidator;
        this.localControlStreamHandler = localControlStreamHandler;
        this.remoteControlStreamHandler = remoteControlStreamHandler;
        this.qpackEncoderHandlerFactory = qpackEncoderHandlerFactory;
        this.qpackDecoderHandlerFactory = qpackDecoderHandlerFactory;
        if (unknownStreamHandlerFactory == null) {
            // If the user did not specify an own factory just drop all bytes on the floor.
            unknownStreamHandlerFactory = type -> ReleaseHandler.INSTANCE;
        }
        this.unknownStreamHandlerFactory = unknownStreamHandlerFactory;
    }

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) {
        if (!in.isReadable()) {
            return;
        }
        int len = Http3CodecUtils.numBytesForVariableLengthInteger(in.getByte(in.readerIndex()));
        if (in.readableBytes() < len) {
            return;
        }
        long type = Http3CodecUtils.readVariableLengthInteger(in, len);
        switch ((int) type) {
            case HTTP3_CONTROL_STREAM_TYPE:
                initControlStream(ctx);
                break;
            case HTTP3_PUSH_STREAM_TYPE:
                int pushIdLen = Http3CodecUtils.numBytesForVariableLengthInteger(in.getByte(in.readerIndex()));
                if (in.readableBytes() < pushIdLen) {
                    return;
                }
                long pushId = Http3CodecUtils.readVariableLengthInteger(in, pushIdLen);
                initPushStream(ctx, pushId);
                break;
            case HTTP3_QPACK_ENCODER_STREAM_TYPE:
                // See https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#enc-dec-stream-def
                initQpackEncoderStream(ctx);
                break;
            case HTTP3_QPACK_DECODER_STREAM_TYPE:
                // See https://quicwg.org/base-drafts/draft-ietf-quic-qpack.html#enc-dec-stream-def
                initQpackDecoderStream(ctx);
                break;
            default:
                initUnknownStream(ctx, type);
                break;
        }
    }

    /**
     * Called if the current {@link Channel} is a
     * <a href="https://tools.ietf.org/html/draft-ietf-quic-http-32#section-6.2.1">control stream</a>.
     */
    private void initControlStream(ChannelHandlerContext ctx) {
        if (ctx.channel().parent().attr(REMOTE_CONTROL_STREAM).setIfAbsent(true) == null) {
            ctx.pipeline().addLast(localControlStreamHandler);
            // Replace this handler with the codec now.
            ctx.pipeline().replace(this, null,
                    codecFactory.newCodec(Http3ControlStreamFrameTypeValidator.INSTANCE, NO_STATE,

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free