Home / Function/ handleOversizedMessage() — netty Function Reference

handleOversizedMessage() — netty Function Reference

Architecture documentation for the handleOversizedMessage() function in HttpObjectAggregator.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  721c7154_0e41_7447_20f0_2595193fc70b["handleOversizedMessage()"]
  a76e3e26_7290_bbe0_3351_75d99b1319d1["HttpObjectAggregator"]
  721c7154_0e41_7447_20f0_2595193fc70b -->|defined in| a76e3e26_7290_bbe0_3351_75d99b1319d1
  style 721c7154_0e41_7447_20f0_2595193fc70b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectAggregator.java lines 241–271

    @Override
    protected void handleOversizedMessage(final ChannelHandlerContext ctx, HttpMessage oversized) throws Exception {
        if (oversized instanceof HttpRequest) {
            // send back a 413 and close the connection

            // If the client started to send data already, close because it's impossible to recover.
            // If keep-alive is off and 'Expect: 100-continue' is missing, no need to leave the connection open.
            if (oversized instanceof FullHttpMessage ||
                !HttpUtil.is100ContinueExpected(oversized) && !HttpUtil.isKeepAlive(oversized)) {
                ChannelFuture future = ctx.writeAndFlush(TOO_LARGE_CLOSE.retainedDuplicate());
                future.addListener(f -> {
                    if (!f.isSuccess()) {
                        logger.debug("Failed to send a 413 Request Entity Too Large.", f.cause());
                    }
                    ctx.close();
                });
            } else {
                ctx.writeAndFlush(TOO_LARGE.retainedDuplicate()).addListener(future -> {
                    if (!future.isSuccess()) {
                        logger.debug("Failed to send a 413 Request Entity Too Large.", future.cause());
                        ctx.close();
                    }
                });
            }
        } else if (oversized instanceof HttpResponse) {
            ctx.close();
            throw new TooLongHttpContentException("Response entity too large: " + oversized);
        } else {
            throw new IllegalStateException();
        }
    }

Subdomains

Frequently Asked Questions

What does handleOversizedMessage() do?
handleOversizedMessage() is a function in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectAggregator.java.
Where is handleOversizedMessage() defined?
handleOversizedMessage() is defined in codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectAggregator.java at line 241.

Analyze Your Own Codebase

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

Try Supermodel Free