Home / Function/ sendHttpResponse() — netty Function Reference

sendHttpResponse() — netty Function Reference

Architecture documentation for the sendHttpResponse() function in WebSocketServerHandler.java from the netty codebase.

Function java Buffer Telemetry calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  e1c780b8_8a58_a843_981f_2378e8000b08["sendHttpResponse()"]
  3f7d4c4e_8262_9dae_1834_1af8d0f2e6dd["WebSocketServerHandler"]
  e1c780b8_8a58_a843_981f_2378e8000b08 -->|defined in| 3f7d4c4e_8262_9dae_1834_1af8d0f2e6dd
  fcec6aed_39e7_3b17_aeb4_b612a777c609["handleHttpRequest()"]
  fcec6aed_39e7_3b17_aeb4_b612a777c609 -->|calls| e1c780b8_8a58_a843_981f_2378e8000b08
  508ffeb5_9c37_f836_dadf_0849a826f397["channelReadComplete()"]
  e1c780b8_8a58_a843_981f_2378e8000b08 -->|calls| 508ffeb5_9c37_f836_dadf_0849a826f397
  style e1c780b8_8a58_a843_981f_2378e8000b08 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http/websocketx/benchmarkserver/WebSocketServerHandler.java lines 132–146

    private static void sendHttpResponse(ChannelHandlerContext ctx, FullHttpRequest req, FullHttpResponse res) {
        // Generate an error page if response getStatus code is not OK (200).
        HttpResponseStatus responseStatus = res.status();
        if (responseStatus.code() != 200) {
            ByteBufUtil.writeUtf8(res.content(), responseStatus.toString());
            HttpUtil.setContentLength(res, res.content().readableBytes());
        }
        // Send the response and close the connection if necessary.
        boolean keepAlive = HttpUtil.isKeepAlive(req) && responseStatus.code() == 200;
        HttpUtil.setKeepAlive(res, keepAlive);
        ChannelFuture future = ctx.write(res); // Flushed in channelReadComplete()
        if (!keepAlive) {
            future.addListener(ChannelFutureListener.CLOSE);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does sendHttpResponse() do?
sendHttpResponse() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/http/websocketx/benchmarkserver/WebSocketServerHandler.java.
Where is sendHttpResponse() defined?
sendHttpResponse() is defined in example/src/main/java/io/netty/example/http/websocketx/benchmarkserver/WebSocketServerHandler.java at line 132.
What does sendHttpResponse() call?
sendHttpResponse() calls 1 function(s): channelReadComplete.
What calls sendHttpResponse()?
sendHttpResponse() is called by 1 function(s): handleHttpRequest.

Analyze Your Own Codebase

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

Try Supermodel Free