InboundHttp2ToHttpAdapter Class — netty Architecture
Architecture documentation for the InboundHttp2ToHttpAdapter class in InboundHttp2ToHttpAdapter.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD aed86996_f518_c45d_5bdf_47241b8bdd57["InboundHttp2ToHttpAdapter"] b162587a_9dd5_7767_85f1_a82b1fca64a0["InboundHttp2ToHttpAdapter.java"] aed86996_f518_c45d_5bdf_47241b8bdd57 -->|defined in| b162587a_9dd5_7767_85f1_a82b1fca64a0 3caf00b7_fa9d_c05d_de6d_7a492c6de3f4["InboundHttp2ToHttpAdapter()"] aed86996_f518_c45d_5bdf_47241b8bdd57 -->|method| 3caf00b7_fa9d_c05d_de6d_7a492c6de3f4 662defdf_c364_32c0_c283_775e72f3676f["removeMessage()"] aed86996_f518_c45d_5bdf_47241b8bdd57 -->|method| 662defdf_c364_32c0_c283_775e72f3676f f1d610a2_3c24_d241_27ce_92afa7c64f42["FullHttpMessage()"] aed86996_f518_c45d_5bdf_47241b8bdd57 -->|method| f1d610a2_3c24_d241_27ce_92afa7c64f42 77235bd2_0902_c2b3_6eb8_b6274b377353["putMessage()"] aed86996_f518_c45d_5bdf_47241b8bdd57 -->|method| 77235bd2_0902_c2b3_6eb8_b6274b377353 2b8b19c7_b6e3_ad7d_df41_ef6826c4261f["onStreamRemoved()"] aed86996_f518_c45d_5bdf_47241b8bdd57 -->|method| 2b8b19c7_b6e3_ad7d_df41_ef6826c4261f dd41a085_6ba9_3e5b_7096_37e5368a853b["fireChannelRead()"] aed86996_f518_c45d_5bdf_47241b8bdd57 -->|method| dd41a085_6ba9_3e5b_7096_37e5368a853b dba66dc8_e4ba_9648_2ce7_0781414afe89["processHeadersEnd()"] aed86996_f518_c45d_5bdf_47241b8bdd57 -->|method| dba66dc8_e4ba_9648_2ce7_0781414afe89 705b432a_f86e_1860_a699_d7ea944f432f["onDataRead()"] aed86996_f518_c45d_5bdf_47241b8bdd57 -->|method| 705b432a_f86e_1860_a699_d7ea944f432f 4aaf42f4_a0b4_d610_bbb6_b928f406c92f["onHeadersRead()"] aed86996_f518_c45d_5bdf_47241b8bdd57 -->|method| 4aaf42f4_a0b4_d610_bbb6_b928f406c92f 5f909953_5fdd_34c9_dc10_f090512a3967["onRstStreamRead()"] aed86996_f518_c45d_5bdf_47241b8bdd57 -->|method| 5f909953_5fdd_34c9_dc10_f090512a3967 96c7030b_18d4_a4a9_4d43_ced9a559422c["onPushPromiseRead()"] aed86996_f518_c45d_5bdf_47241b8bdd57 -->|method| 96c7030b_18d4_a4a9_4d43_ced9a559422c 517bfb71_063e_1628_6eac_3e1ea271a2cf["onSettingsRead()"] aed86996_f518_c45d_5bdf_47241b8bdd57 -->|method| 517bfb71_063e_1628_6eac_3e1ea271a2cf
Relationship Graph
Source Code
codec-http2/src/main/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapter.java lines 40–358
public class InboundHttp2ToHttpAdapter extends Http2EventAdapter {
private static final ImmediateSendDetector DEFAULT_SEND_DETECTOR = new ImmediateSendDetector() {
@Override
public boolean mustSendImmediately(FullHttpMessage msg) {
if (msg instanceof FullHttpResponse) {
return ((FullHttpResponse) msg).status().codeClass() == HttpStatusClass.INFORMATIONAL;
}
if (msg instanceof FullHttpRequest) {
return msg.headers().contains(HttpHeaderNames.EXPECT);
}
return false;
}
@Override
public FullHttpMessage copyIfNeeded(ByteBufAllocator allocator, FullHttpMessage msg) {
if (msg instanceof FullHttpRequest) {
FullHttpRequest copy = ((FullHttpRequest) msg).replace(allocator.buffer(0));
copy.headers().remove(HttpHeaderNames.EXPECT);
return copy;
}
return null;
}
};
private final int maxContentLength;
private final ImmediateSendDetector sendDetector;
private final Http2Connection.PropertyKey messageKey;
private final boolean propagateSettings;
protected final Http2Connection connection;
protected final boolean validateHttpHeaders;
protected InboundHttp2ToHttpAdapter(Http2Connection connection, int maxContentLength,
boolean validateHttpHeaders, boolean propagateSettings) {
this.connection = checkNotNull(connection, "connection");
this.maxContentLength = checkPositive(maxContentLength, "maxContentLength");
this.validateHttpHeaders = validateHttpHeaders;
this.propagateSettings = propagateSettings;
sendDetector = DEFAULT_SEND_DETECTOR;
messageKey = connection.newKey();
}
/**
* The stream is out of scope for the HTTP message flow and will no longer be tracked
* @param stream The stream to remove associated state with
* @param release {@code true} to call release on the value if it is present. {@code false} to not call release.
*/
protected final void removeMessage(Http2Stream stream, boolean release) {
FullHttpMessage msg = stream.removeProperty(messageKey);
if (release && msg != null) {
msg.release();
}
}
/**
* Get the {@link FullHttpMessage} associated with {@code stream}.
* @param stream The stream to get the associated state from
* @return The {@link FullHttpMessage} associated with {@code stream}.
*/
protected final FullHttpMessage getMessage(Http2Stream stream) {
return (FullHttpMessage) stream.getProperty(messageKey);
}
/**
* Make {@code message} be the state associated with {@code stream}.
* @param stream The stream which {@code message} is associated with.
* @param message The message which contains the HTTP semantics.
*/
protected final void putMessage(Http2Stream stream, FullHttpMessage message) {
FullHttpMessage previous = stream.setProperty(messageKey, message);
if (previous != message && previous != null) {
previous.release();
}
}
@Override
public void onStreamRemoved(Http2Stream stream) {
removeMessage(stream, true);
}
/**
* Set final headers and fire a channel read event
Source
Frequently Asked Questions
What is the InboundHttp2ToHttpAdapter class?
InboundHttp2ToHttpAdapter is a class in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapter.java.
Where is InboundHttp2ToHttpAdapter defined?
InboundHttp2ToHttpAdapter is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapter.java at line 40.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free