channelRead0() — netty Function Reference
Architecture documentation for the channelRead0() function in HelloWorldHttp1Handler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 59fb26e3_d6a1_690c_13d0_0421f708e901["channelRead0()"] 653a7c94_6dfd_89c0_369e_fe695dc47f43["HelloWorldHttp1Handler"] 59fb26e3_d6a1_690c_13d0_0421f708e901 -->|defined in| 653a7c94_6dfd_89c0_369e_fe695dc47f43 style 59fb26e3_d6a1_690c_13d0_0421f708e901 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
example/src/main/java/io/netty/example/http2/helloworld/server/HelloWorldHttp1Handler.java lines 50–75
@Override
public void channelRead0(ChannelHandlerContext ctx, FullHttpRequest req) throws Exception {
if (HttpUtil.is100ContinueExpected(req)) {
ctx.write(new DefaultFullHttpResponse(HTTP_1_1, CONTINUE, Unpooled.EMPTY_BUFFER));
}
ByteBuf content = ctx.alloc().buffer();
content.writeBytes(HelloWorldHttp2Handler.RESPONSE_BYTES.duplicate());
ByteBufUtil.writeAscii(content, " - via " + req.protocolVersion() + " (" + establishApproach + ")");
FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, OK, content);
response.headers().set(CONTENT_TYPE, "text/plain; charset=UTF-8");
response.headers().setInt(CONTENT_LENGTH, response.content().readableBytes());
boolean keepAlive = HttpUtil.isKeepAlive(req);
if (keepAlive) {
if (req.protocolVersion().equals(HTTP_1_0)) {
response.headers().set(CONNECTION, KEEP_ALIVE);
}
ctx.write(response);
} else {
// Tell the client we're going to close the connection.
response.headers().set(CONNECTION, CLOSE);
ctx.write(response).addListener(ChannelFutureListener.CLOSE);
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does channelRead0() do?
channelRead0() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/http2/helloworld/server/HelloWorldHttp1Handler.java.
Where is channelRead0() defined?
channelRead0() is defined in example/src/main/java/io/netty/example/http2/helloworld/server/HelloWorldHttp1Handler.java at line 50.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free