channelRead0() — netty Function Reference
Architecture documentation for the channelRead0() function in HttpHelloWorldServerHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD dfe99b30_4ec0_fab2_6dc2_b98b1d6e8b87["channelRead0()"] d21156b2_704d_97ce_4792_ad34bc69e57f["HttpHelloWorldServerHandler"] dfe99b30_4ec0_fab2_6dc2_b98b1d6e8b87 -->|defined in| d21156b2_704d_97ce_4792_ad34bc69e57f style dfe99b30_4ec0_fab2_6dc2_b98b1d6e8b87 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
example/src/main/java/io/netty/example/http/helloworld/HttpHelloWorldServerHandler.java lines 45–72
@Override
public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) {
if (msg instanceof HttpRequest) {
HttpRequest req = (HttpRequest) msg;
boolean keepAlive = HttpUtil.isKeepAlive(req);
FullHttpResponse response = new DefaultFullHttpResponse(req.protocolVersion(), OK,
Unpooled.wrappedBuffer(CONTENT));
response.headers()
.set(CONTENT_TYPE, TEXT_PLAIN)
.setInt(CONTENT_LENGTH, response.content().readableBytes());
if (keepAlive) {
if (!req.protocolVersion().isKeepAliveDefault()) {
response.headers().set(CONNECTION, KEEP_ALIVE);
}
} else {
// Tell the client we're going to close the connection.
response.headers().set(CONNECTION, CLOSE);
}
ChannelFuture f = ctx.write(response);
if (!keepAlive) {
f.addListener(ChannelFutureListener.CLOSE);
}
}
}
Domain
Subdomains
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/http/helloworld/HttpHelloWorldServerHandler.java.
Where is channelRead0() defined?
channelRead0() is defined in example/src/main/java/io/netty/example/http/helloworld/HttpHelloWorldServerHandler.java at line 45.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free