Http3FrameToHttpObjectCodec Class — netty Architecture
Architecture documentation for the Http3FrameToHttpObjectCodec class in Http3FrameToHttpObjectCodec.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 89b6ef44_7b8b_bd87_22f1_6b099293d25d["Http3FrameToHttpObjectCodec"] 343b980b_c00b_586e_0c5e_c55290ca8c4b["Http3FrameToHttpObjectCodec.java"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|defined in| 343b980b_c00b_586e_0c5e_c55290ca8c4b cfab72ac_f890_ba99_0992_836aaba7b6d6["Http3FrameToHttpObjectCodec()"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|method| cfab72ac_f890_ba99_0992_836aaba7b6d6 8ea7cd64_861d_58b0_cb9b_b8a863cae9c8["isSharable()"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|method| 8ea7cd64_861d_58b0_cb9b_b8a863cae9c8 9b05fd47_3236_7abf_c543_7d67499c0ed7["channelRead()"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|method| 9b05fd47_3236_7abf_c543_7d67499c0ed7 21e1b6c7_c1e0_e563_7c4d_387989e8468d["channelInputClosed()"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|method| 21e1b6c7_c1e0_e563_7c4d_387989e8468d 76b7e29c_b468_1120_b8de_3bb312465670["write()"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|method| 76b7e29c_b468_1120_b8de_3bb312465670 1732bdd0_e0f1_4455_0b06_9b07872f84d8["ChannelPromise()"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|method| 1732bdd0_e0f1_4455_0b06_9b07872f84d8 889593d7_39bc_b816_1435_377ff3d98434["Http3Headers()"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|method| 889593d7_39bc_b816_1435_377ff3d98434 725c4efd_9fb2_a345_7051_5d257f40b3d0["HttpMessage()"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|method| 725c4efd_9fb2_a345_7051_5d257f40b3d0 7e0b384f_8341_caf6_1f21_922675452028["FullHttpMessage()"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|method| 7e0b384f_8341_caf6_1f21_922675452028 55f5b91f_0ac9_e864_2c2c_1ed9414f61d9["flush()"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|method| 55f5b91f_0ac9_e864_2c2c_1ed9414f61d9 085e18a3_30ee_a1cb_3d33_e9e63326822c["bind()"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|method| 085e18a3_30ee_a1cb_3d33_e9e63326822c cbb08bc7_3538_5514_be76_a1be518fb04f["connect()"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|method| cbb08bc7_3538_5514_be76_a1be518fb04f b070af6d_93d5_041b_885a_322fefba6190["disconnect()"] 89b6ef44_7b8b_bd87_22f1_6b099293d25d -->|method| b070af6d_93d5_041b_885a_322fefba6190
Relationship Graph
Source Code
codec-http3/src/main/java/io/netty/handler/codec/http3/Http3FrameToHttpObjectCodec.java lines 58–298
public final class Http3FrameToHttpObjectCodec extends Http3RequestStreamInboundHandler
implements ChannelOutboundHandler {
private final boolean isServer;
private final boolean validateHeaders;
private boolean inboundTranslationInProgress;
public Http3FrameToHttpObjectCodec(final boolean isServer,
final boolean validateHeaders) {
this.isServer = isServer;
this.validateHeaders = validateHeaders;
}
public Http3FrameToHttpObjectCodec(final boolean isServer) {
this(isServer, true);
}
@Override
public boolean isSharable() {
return false;
}
@Override
protected void channelRead(ChannelHandlerContext ctx, Http3HeadersFrame frame) throws Exception {
Http3Headers headers = frame.headers();
long id = ((QuicStreamChannel) ctx.channel()).streamId();
final CharSequence status = headers.status();
// 100-continue response is a special case where we should not send a fin,
// but we need to decode it as a FullHttpResponse to play nice with HttpObjectAggregator.
if (null != status && HttpResponseStatus.CONTINUE.codeAsText().contentEquals(status)) {
final FullHttpMessage fullMsg = newFullMessage(id, headers, ctx.alloc());
ctx.fireChannelRead(fullMsg);
return;
}
if (headers.method() == null && status == null) {
// Must be trailers!
LastHttpContent last = new DefaultLastHttpContent(Unpooled.EMPTY_BUFFER, validateHeaders);
HttpConversionUtil.addHttp3ToHttpHeaders(id, headers, last.trailingHeaders(),
HttpVersion.HTTP_1_1, true, true);
inboundTranslationInProgress = false;
ctx.fireChannelRead(last);
} else {
HttpMessage req = newMessage(id, headers);
if (!HttpUtil.isContentLengthSet(req)) {
req.headers().add(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED);
}
inboundTranslationInProgress = true;
ctx.fireChannelRead(req);
}
}
@Override
protected void channelRead(ChannelHandlerContext ctx, Http3DataFrame frame) throws Exception {
inboundTranslationInProgress = true;
ctx.fireChannelRead(new DefaultHttpContent(frame.content()));
}
@Override
protected void channelInputClosed(ChannelHandlerContext ctx) throws Exception {
if (inboundTranslationInProgress) {
ctx.fireChannelRead(LastHttpContent.EMPTY_LAST_CONTENT);
}
}
/**
* Encode from an {@link HttpObject} to an {@link Http3RequestStreamFrame}. This method will
* be called for each written message that can be handled by this encoder.
*
* NOTE: 100-Continue responses that are NOT {@link FullHttpResponse} will be rejected.
*
* @param ctx the {@link ChannelHandlerContext} which this handler belongs to
* @param msg the {@link HttpObject} message to encode
* @throws Exception is thrown if an error occurs
*/
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
if (!(msg instanceof HttpObject)) {
throw new UnsupportedMessageTypeException(msg, HttpObject.class);
Source
Frequently Asked Questions
What is the Http3FrameToHttpObjectCodec class?
Http3FrameToHttpObjectCodec is a class in the netty codebase, defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3FrameToHttpObjectCodec.java.
Where is Http3FrameToHttpObjectCodec defined?
Http3FrameToHttpObjectCodec is defined in codec-http3/src/main/java/io/netty/handler/codec/http3/Http3FrameToHttpObjectCodec.java at line 58.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free