Home / Function/ channelRead0() — netty Function Reference

channelRead0() — netty Function Reference

Architecture documentation for the channelRead0() function in HelloWorldHttp1Handler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  330baa21_2718_139e_7525_9e881786420a["channelRead0()"]
  f95b74b1_4022_4234_ac28_b2c846d5eeb9["HelloWorldHttp1Handler"]
  330baa21_2718_139e_7525_9e881786420a -->|defined in| f95b74b1_4022_4234_ac28_b2c846d5eeb9
  style 330baa21_2718_139e_7525_9e881786420a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

testsuite-http2/src/main/java/io/netty/testsuite/http2/HelloWorldHttp1Handler.java lines 47–68

    @Override
    public void channelRead0(ChannelHandlerContext ctx, FullHttpRequest req) throws Exception {
        if (HttpUtil.is100ContinueExpected(req)) {
            ctx.write(new DefaultFullHttpResponse(HTTP_1_1, CONTINUE, ctx.alloc().buffer(0)));
        }
        boolean keepAlive = HttpUtil.isKeepAlive(req);

        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());

        if (!keepAlive) {
            ctx.write(response).addListener(ChannelFutureListener.CLOSE);
        } else {
            response.headers().set(CONNECTION, HttpHeaderValues.KEEP_ALIVE);
            ctx.write(response);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does channelRead0() do?
channelRead0() is a function in the netty codebase, defined in testsuite-http2/src/main/java/io/netty/testsuite/http2/HelloWorldHttp1Handler.java.
Where is channelRead0() defined?
channelRead0() is defined in testsuite-http2/src/main/java/io/netty/testsuite/http2/HelloWorldHttp1Handler.java at line 47.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free