Http2FrameCodec Class — netty Architecture
Architecture documentation for the Http2FrameCodec class in Http2FrameCodec.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD ba77a225_4637_fe77_ee1f_54a9774ca7f8["Http2FrameCodec"] bc7ad616_b6c9_c3f9_4388_1ec2dab7e120["Http2FrameCodec.java"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|defined in| bc7ad616_b6c9_c3f9_4388_1ec2dab7e120 edf98085_6a6f_df38_d6ce_66cf410f3a3e["Http2FrameCodec()"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|method| edf98085_6a6f_df38_d6ce_66cf410f3a3e d0e1d0d7_7352_fc3f_42eb_63b1506f5fcd["DefaultHttp2FrameStream()"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|method| d0e1d0d7_7352_fc3f_42eb_63b1506f5fcd 7e667673_a02e_10ed_facf_a81ced981c1c["forEachActiveStream()"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|method| 7e667673_a02e_10ed_facf_a81ced981c1c 4a6bc639_dbf6_8696_6342_6db140049fbb["numInitializingStreams()"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|method| 4a6bc639_dbf6_8696_6342_6db140049fbb 7795823d_413a_96d1_ee63_6dda0df913d5["handlerAdded()"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|method| 7795823d_413a_96d1_ee63_6dda0df913d5 00a9b5ed_642d_3de9_0443_03f66b22d1c8["tryExpandConnectionFlowControlWindow()"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|method| 00a9b5ed_642d_3de9_0443_03f66b22d1c8 358e96dd_3d48_85e7_22b9_70378f4e324e["handlerAdded0()"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|method| 358e96dd_3d48_85e7_22b9_70378f4e324e 4c3d3913_a400_e447_0997_8e68ce8c89a7["userEventTriggered()"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|method| 4c3d3913_a400_e447_0997_8e68ce8c89a7 f506663e_a3fd_bcb6_ca40_6da0b91c8c1c["onUserEventTriggered()"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|method| f506663e_a3fd_bcb6_ca40_6da0b91c8c1c dabb27f9_26d0_6cce_3476_d90ad2682131["write()"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|method| dabb27f9_26d0_6cce_3476_d90ad2682131 04411e16_ed38_8b7c_ab2f_823a00072c36["increaseInitialConnectionWindow()"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|method| 04411e16_ed38_8b7c_ab2f_823a00072c36 dafb708f_d534_42b0_93ed_f04119450f7d["consumeBytes()"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|method| dafb708f_d534_42b0_93ed_f04119450f7d 2f958372_1e41_1ad3_a4a7_5139b366d29b["writeGoAwayFrame()"] ba77a225_4637_fe77_ee1f_54a9774ca7f8 -->|method| 2f958372_1e41_1ad3_a4a7_5139b366d29b
Relationship Graph
Source Code
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodec.java lines 144–788
public class Http2FrameCodec extends Http2ConnectionHandler {
private static final InternalLogger LOG = InternalLoggerFactory.getInstance(Http2FrameCodec.class);
private static final Class<?>[] SUPPORTED_MESSAGES = new Class[] {
Http2DataFrame.class, Http2HeadersFrame.class, Http2WindowUpdateFrame.class, Http2ResetFrame.class,
Http2PingFrame.class, Http2SettingsFrame.class, Http2SettingsAckFrame.class, Http2GoAwayFrame.class,
Http2PushPromiseFrame.class, Http2PriorityFrame.class, Http2UnknownFrame.class };
protected final PropertyKey streamKey;
private final PropertyKey upgradeKey;
private final Integer initialFlowControlWindowSize;
ChannelHandlerContext ctx;
/**
* Number of buffered streams if the {@link StreamBufferingEncoder} is used.
**/
private int numBufferedStreams;
private final IntObjectMap<DefaultHttp2FrameStream> frameStreamToInitializeMap =
new IntObjectHashMap<DefaultHttp2FrameStream>(8);
protected Http2FrameCodec(Http2ConnectionEncoder encoder, Http2ConnectionDecoder decoder,
Http2Settings initialSettings, boolean decoupleCloseAndGoAway, boolean flushPreface) {
super(decoder, encoder, initialSettings, decoupleCloseAndGoAway, flushPreface);
decoder.frameListener(new FrameListener());
connection().addListener(new ConnectionListener());
connection().remote().flowController().listener(new Http2RemoteFlowControllerListener());
streamKey = connection().newKey();
upgradeKey = connection().newKey();
initialFlowControlWindowSize = initialSettings.initialWindowSize();
}
/**
* Creates a new outbound/local stream.
*/
DefaultHttp2FrameStream newStream() {
return new DefaultHttp2FrameStream();
}
/**
* Iterates over all active HTTP/2 streams.
*
* <p>This method must not be called outside of the event loop.
*/
final void forEachActiveStream(final Http2FrameStreamVisitor streamVisitor) throws Http2Exception {
assert ctx.executor().inEventLoop();
if (connection().numActiveStreams() > 0) {
connection().forEachActiveStream(new Http2StreamVisitor() {
@Override
public boolean visit(Http2Stream stream) {
try {
return streamVisitor.visit((Http2FrameStream) stream.getProperty(streamKey));
} catch (Throwable cause) {
onError(ctx, false, cause);
return false;
}
}
});
}
}
/**
* Retrieve the number of streams currently in the process of being initialized.
* <p>
* This is package-private for testing only.
*/
int numInitializingStreams() {
return frameStreamToInitializeMap.size();
}
@Override
public final void handlerAdded(ChannelHandlerContext ctx) throws Exception {
this.ctx = ctx;
super.handlerAdded(ctx);
handlerAdded0(ctx);
// Must be after Http2ConnectionHandler does its initialization in handlerAdded above.
// The server will not send a connection preface so we are good to send a window update.
Http2Connection connection = connection();
Source
Frequently Asked Questions
What is the Http2FrameCodec class?
Http2FrameCodec is a class in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodec.java.
Where is Http2FrameCodec defined?
Http2FrameCodec is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodec.java at line 144.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free