Home / Function/ sendAndCleanupConnection() — netty Function Reference

sendAndCleanupConnection() — netty Function Reference

Architecture documentation for the sendAndCleanupConnection() function in HttpStaticFileServerHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  387357b5_0623_04d6_d7dd_f0074f835df9["sendAndCleanupConnection()"]
  02ca82d7_508c_aabe_bb4d_dd1603c38b01["HttpStaticFileServerHandler"]
  387357b5_0623_04d6_d7dd_f0074f835df9 -->|defined in| 02ca82d7_508c_aabe_bb4d_dd1603c38b01
  2d9abdcf_0bde_4318_74f6_8a20cb48fc08["sendListing()"]
  2d9abdcf_0bde_4318_74f6_8a20cb48fc08 -->|calls| 387357b5_0623_04d6_d7dd_f0074f835df9
  6c5cbb5e_8e83_4646_b043_db847af45914["sendRedirect()"]
  6c5cbb5e_8e83_4646_b043_db847af45914 -->|calls| 387357b5_0623_04d6_d7dd_f0074f835df9
  e8aaebf5_6ec4_adec_aa31_f32cf1d41e60["sendError()"]
  e8aaebf5_6ec4_adec_aa31_f32cf1d41e60 -->|calls| 387357b5_0623_04d6_d7dd_f0074f835df9
  33129c23_d788_1580_659d_7761765ab670["sendNotModified()"]
  33129c23_d788_1580_659d_7761765ab670 -->|calls| 387357b5_0623_04d6_d7dd_f0074f835df9
  style 387357b5_0623_04d6_d7dd_f0074f835df9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java lines 352–370

    private void sendAndCleanupConnection(ChannelHandlerContext ctx, FullHttpResponse response) {
        final FullHttpRequest request = this.request;
        final boolean keepAlive = HttpUtil.isKeepAlive(request);
        HttpUtil.setContentLength(response, response.content().readableBytes());
        if (!keepAlive) {
            // We're going to close the connection as soon as the response is sent,
            // so we should also make it clear for the client.
            response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE);
        } else if (request.protocolVersion().equals(HTTP_1_0)) {
            response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
        }

        ChannelFuture flushPromise = ctx.writeAndFlush(response);

        if (!keepAlive) {
            // Close the connection as soon as the response is sent.
            flushPromise.addListener(ChannelFutureListener.CLOSE);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does sendAndCleanupConnection() do?
sendAndCleanupConnection() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java.
Where is sendAndCleanupConnection() defined?
sendAndCleanupConnection() is defined in example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java at line 352.
What calls sendAndCleanupConnection()?
sendAndCleanupConnection() is called by 4 function(s): sendError, sendListing, sendNotModified, sendRedirect.

Analyze Your Own Codebase

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

Try Supermodel Free