channelRead0() — netty Function Reference
Architecture documentation for the channelRead0() function in HttpHelloWorldServerHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 6ff65132_2bf7_69bc_0218_fa069113dc87["channelRead0()"] ecd87b1b_17db_6be0_8c18_3e5736e61a40["HttpHelloWorldServerHandler"] 6ff65132_2bf7_69bc_0218_fa069113dc87 -->|defined in| ecd87b1b_17db_6be0_8c18_3e5736e61a40 style 6ff65132_2bf7_69bc_0218_fa069113dc87 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
testsuite-jpms/src/main/java/io/netty/testsuite_jpms/main/HttpHelloWorldServerHandler.java lines 47–77
@Override
public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) {
if (msg instanceof HttpRequest) {
HttpRequest req = (HttpRequest) msg;
String hello = HttpHelloWorldServer.content(ctx);
boolean keepAlive = HttpUtil.isKeepAlive(req);
FullHttpResponse response = new DefaultFullHttpResponse(
req.protocolVersion(), OK,
Unpooled.copiedBuffer(hello, StandardCharsets.UTF_8));
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
Defined In
Source
Frequently Asked Questions
What does channelRead0() do?
channelRead0() is a function in the netty codebase, defined in testsuite-jpms/src/main/java/io/netty/testsuite_jpms/main/HttpHelloWorldServerHandler.java.
Where is channelRead0() defined?
channelRead0() is defined in testsuite-jpms/src/main/java/io/netty/testsuite_jpms/main/HttpHelloWorldServerHandler.java at line 47.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free