Home / Function/ channelRead() — netty Function Reference

channelRead() — netty Function Reference

Architecture documentation for the channelRead() function in CorsHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  027a5736_cffb_b2ba_1d21_bab8955f01f6["channelRead()"]
  48d2af19_d0e9_a2f5_8280_607eb2335be4["CorsHandler"]
  027a5736_cffb_b2ba_1d21_bab8955f01f6 -->|defined in| 48d2af19_d0e9_a2f5_8280_607eb2335be4
  9d53585d_ffbc_c503_7ed7_7772002f41b2["isPreflightRequest()"]
  027a5736_cffb_b2ba_1d21_bab8955f01f6 -->|calls| 9d53585d_ffbc_c503_7ed7_7772002f41b2
  a3528954_dd41_114c_963f_7d9056bea918["handlePreflight()"]
  027a5736_cffb_b2ba_1d21_bab8955f01f6 -->|calls| a3528954_dd41_114c_963f_7d9056bea918
  6746e34a_f660_cdc7_e5ca_2bbc073582b0["forbidden()"]
  027a5736_cffb_b2ba_1d21_bab8955f01f6 -->|calls| 6746e34a_f660_cdc7_e5ca_2bbc073582b0
  style 027a5736_cffb_b2ba_1d21_bab8955f01f6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/cors/CorsHandler.java lines 85–116

    @Override
    public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception {
        if (msg instanceof HttpRequest) {
            request = (HttpRequest) msg;
            final String origin = request.headers().get(HttpHeaderNames.ORIGIN);
            config = getForOrigin(origin);
            if (isPreflightRequest(request)) {
                handlePreflight(ctx, request);
                // Enable consumeContent so that all following HttpContent
                // for this request will be released and not propagated downstream.
                consumeContent = true;
                return;
            }
            if (isShortCircuit && !(origin == null || config != null)) {
                forbidden(ctx, request);
                consumeContent = true;
                return;
            }

            // This request is forwarded, stop discarding
            consumeContent = false;
            ctx.fireChannelRead(msg);
            return;
        }

        if (consumeContent && (msg instanceof HttpContent)) {
            ReferenceCountUtil.release(msg);
            return;
        }

        ctx.fireChannelRead(msg);
    }

Subdomains

Frequently Asked Questions

What does channelRead() do?
channelRead() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/cors/CorsHandler.java.
Where is channelRead() defined?
channelRead() is defined in codec-http/src/main/java/io/netty/handler/codec/http/cors/CorsHandler.java at line 85.
What does channelRead() call?
channelRead() calls 3 function(s): forbidden, handlePreflight, isPreflightRequest.

Analyze Your Own Codebase

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

Try Supermodel Free