Home / Function/ channelRead0() — netty Function Reference

channelRead0() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a2c90322_aea7_93db_a3b3_6c785b6a2668["channelRead0()"]
  b42dfc71_9168_e756_15f4_7d0276b026db["StompWebSocketClientPageHandler"]
  a2c90322_aea7_93db_a3b3_6c785b6a2668 -->|defined in| b42dfc71_9168_e756_15f4_7d0276b026db
  f59e6f53_60f4_c71f_4c56_9c745733d169["sendResponse()"]
  a2c90322_aea7_93db_a3b3_6c785b6a2668 -->|calls| f59e6f53_60f4_c71f_4c56_9c745733d169
  1347a6f5_daf3_a657_75a5_08dccb979171["sendResource()"]
  a2c90322_aea7_93db_a3b3_6c785b6a2668 -->|calls| 1347a6f5_daf3_a657_75a5_08dccb979171
  style a2c90322_aea7_93db_a3b3_6c785b6a2668 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/stomp/websocket/StompWebSocketClientPageHandler.java lines 53–74

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) {
        if (request.headers().contains(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET, true)) {
            ctx.fireChannelRead(request.retain());
            return;
        }

        if (request.decoderResult().isFailure()) {
            FullHttpResponse badRequest = new DefaultFullHttpResponse(request.protocolVersion(), BAD_REQUEST);
            sendResponse(badRequest, ctx, true);
            return;
        }

        if (!sendResource(request, ctx)) {
            FullHttpResponse notFound = new DefaultFullHttpResponse(request.protocolVersion(), NOT_FOUND);
            notFound.headers().set(CONTENT_TYPE, TEXT_PLAIN);
            String payload = "Requested resource " + request.uri() + " not found";
            notFound.content().writeCharSequence(payload, CharsetUtil.UTF_8);
            HttpUtil.setContentLength(notFound, notFound.content().readableBytes());
            sendResponse(notFound, ctx, true);
        }
    }

Domain

Subdomains

Frequently Asked Questions

What does channelRead0() do?
channelRead0() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/stomp/websocket/StompWebSocketClientPageHandler.java.
Where is channelRead0() defined?
channelRead0() is defined in example/src/main/java/io/netty/example/stomp/websocket/StompWebSocketClientPageHandler.java at line 53.
What does channelRead0() call?
channelRead0() calls 2 function(s): sendResource, sendResponse.

Analyze Your Own Codebase

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

Try Supermodel Free