Home / Function/ sendResponse() — netty Function Reference

sendResponse() — netty Function Reference

Architecture documentation for the sendResponse() function in Http1RequestHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  eabb302d_5131_9d13_d55d_35e34b96deb6["sendResponse()"]
  2ea0c6b1_70d5_c2f8_f6dd_5ee379123b0f["Http1RequestHandler"]
  eabb302d_5131_9d13_d55d_35e34b96deb6 -->|defined in| 2ea0c6b1_70d5_c2f8_f6dd_5ee379123b0f
  style eabb302d_5131_9d13_d55d_35e34b96deb6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http2/tiles/Http1RequestHandler.java lines 50–69

    @Override
    protected void sendResponse(final ChannelHandlerContext ctx, String streamId, int latency,
            final FullHttpResponse response, final FullHttpRequest request) {
        HttpUtil.setContentLength(response, response.content().readableBytes());
        ctx.executor().schedule(new Runnable() {
            @Override
            public void run() {
                if (isKeepAlive(request)) {
                    if (request.protocolVersion().equals(HTTP_1_0)) {
                        response.headers().set(CONNECTION, KEEP_ALIVE);
                    }
                    ctx.writeAndFlush(response);
                } else {
                    // Tell the client we're going to close the connection.
                    response.headers().set(CONNECTION, CLOSE);
                    ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE);
                }
            }
        }, latency, TimeUnit.MILLISECONDS);
    }

Domain

Subdomains

Frequently Asked Questions

What does sendResponse() do?
sendResponse() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/http2/tiles/Http1RequestHandler.java.
Where is sendResponse() defined?
sendResponse() is defined in example/src/main/java/io/netty/example/http2/tiles/Http1RequestHandler.java at line 50.

Analyze Your Own Codebase

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

Try Supermodel Free