Home / Function/ sendHttpResponse() — netty Function Reference

sendHttpResponse() — netty Function Reference

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

Function java Buffer Search called by 1

Entity Profile

Dependency Diagram

graph TD
  966de156_0f8c_6b06_20a6_e0712003b649["sendHttpResponse()"]
  8ea989dc_fe6f_0b1b_4077_4a12c09b3008["WebSocketIndexPageHandler"]
  966de156_0f8c_6b06_20a6_e0712003b649 -->|defined in| 8ea989dc_fe6f_0b1b_4077_4a12c09b3008
  bed3075c_486b_aa7a_c6e9_bbec68fb8e86["channelRead0()"]
  bed3075c_486b_aa7a_c6e9_bbec68fb8e86 -->|calls| 966de156_0f8c_6b06_20a6_e0712003b649
  style 966de156_0f8c_6b06_20a6_e0712003b649 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http/websocketx/server/WebSocketIndexPageHandler.java lines 94–108

    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.writeAndFlush(res);
        if (!keepAlive) {
            future.addListener(ChannelFutureListener.CLOSE);
        }
    }

Domain

Subdomains

Called By

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/server/WebSocketIndexPageHandler.java.
Where is sendHttpResponse() defined?
sendHttpResponse() is defined in example/src/main/java/io/netty/example/http/websocketx/server/WebSocketIndexPageHandler.java at line 94.
What calls sendHttpResponse()?
sendHttpResponse() is called by 1 function(s): channelRead0.

Analyze Your Own Codebase

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

Try Supermodel Free