Home / Class/ WebSocketFrameAggregator Class — netty Architecture

WebSocketFrameAggregator Class — netty Architecture

Architecture documentation for the WebSocketFrameAggregator class in WebSocketFrameAggregator.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  4cfbb008_cdc5_2411_9234_829687fe12b7["WebSocketFrameAggregator"]
  4a9172ed_1310_c8ba_9764_b593e8e83e46["WebSocketFrameAggregator.java"]
  4cfbb008_cdc5_2411_9234_829687fe12b7 -->|defined in| 4a9172ed_1310_c8ba_9764_b593e8e83e46
  129ccd35_f211_b24b_fb67_9b7a0c715fc6["WebSocketFrameAggregator()"]
  4cfbb008_cdc5_2411_9234_829687fe12b7 -->|method| 129ccd35_f211_b24b_fb67_9b7a0c715fc6
  ae544c37_e521_16be_d227_31a8fe4d0642["isStartMessage()"]
  4cfbb008_cdc5_2411_9234_829687fe12b7 -->|method| ae544c37_e521_16be_d227_31a8fe4d0642
  05108e14_8f6d_6e8b_f11f_a343af2c1f0c["isContentMessage()"]
  4cfbb008_cdc5_2411_9234_829687fe12b7 -->|method| 05108e14_8f6d_6e8b_f11f_a343af2c1f0c
  7d34a438_f273_c8c5_db25_f08b076fbd8d["isLastContentMessage()"]
  4cfbb008_cdc5_2411_9234_829687fe12b7 -->|method| 7d34a438_f273_c8c5_db25_f08b076fbd8d
  eb7217f4_85b1_034e_1c55_d8f5bd55ddf4["isAggregated()"]
  4cfbb008_cdc5_2411_9234_829687fe12b7 -->|method| eb7217f4_85b1_034e_1c55_d8f5bd55ddf4
  0ab4607b_7360_5fbd_86ac_9030d8ff16ab["isContentLengthInvalid()"]
  4cfbb008_cdc5_2411_9234_829687fe12b7 -->|method| 0ab4607b_7360_5fbd_86ac_9030d8ff16ab
  5d749c51_0b10_81a3_3f27_233d15df8d6c["Object()"]
  4cfbb008_cdc5_2411_9234_829687fe12b7 -->|method| 5d749c51_0b10_81a3_3f27_233d15df8d6c
  0f7aae43_82db_35fa_34c4_8e32cd4182d9["closeAfterContinueResponse()"]
  4cfbb008_cdc5_2411_9234_829687fe12b7 -->|method| 0f7aae43_82db_35fa_34c4_8e32cd4182d9
  717c5e01_69e5_02df_2cd6_1d3a8acc7b75["ignoreContentAfterContinueResponse()"]
  4cfbb008_cdc5_2411_9234_829687fe12b7 -->|method| 717c5e01_69e5_02df_2cd6_1d3a8acc7b75
  3e204927_6098_57c2_8fb0_56d62fc66d05["WebSocketFrame()"]
  4cfbb008_cdc5_2411_9234_829687fe12b7 -->|method| 3e204927_6098_57c2_8fb0_56d62fc66d05

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketFrameAggregator.java lines 31–101

public class WebSocketFrameAggregator
        extends MessageAggregator<WebSocketFrame, WebSocketFrame, ContinuationWebSocketFrame, WebSocketFrame> {

    /**
     * Creates a new instance
     *
     * @param maxContentLength If the size of the aggregated frame exceeds this value,
     *                         a {@link TooLongFrameException} is thrown.
     */
    public WebSocketFrameAggregator(int maxContentLength) {
        super(maxContentLength, WebSocketFrame.class);
    }

    @Override
    protected boolean isStartMessage(WebSocketFrame msg) throws Exception {
        return msg instanceof TextWebSocketFrame || msg instanceof BinaryWebSocketFrame;
    }

    @Override
    protected boolean isContentMessage(WebSocketFrame msg) throws Exception {
        return msg instanceof ContinuationWebSocketFrame;
    }

    @Override
    protected boolean isLastContentMessage(ContinuationWebSocketFrame msg) throws Exception {
        return isContentMessage(msg) && msg.isFinalFragment();
    }

    @Override
    protected boolean isAggregated(WebSocketFrame msg) throws Exception {
        if (msg.isFinalFragment()) {
            return !isContentMessage(msg);
        }

        return !isStartMessage(msg) && !isContentMessage(msg);
    }

    @Override
    protected boolean isContentLengthInvalid(WebSocketFrame start, int maxContentLength) {
        return false;
    }

    @Override
    protected Object newContinueResponse(WebSocketFrame start, int maxContentLength, ChannelPipeline pipeline) {
        return null;
    }

    @Override
    protected boolean closeAfterContinueResponse(Object msg) throws Exception {
        throw new UnsupportedOperationException();
    }

    @Override
    protected boolean ignoreContentAfterContinueResponse(Object msg) throws Exception {
        throw new UnsupportedOperationException();
    }

    @Override
    protected WebSocketFrame beginAggregation(WebSocketFrame start, ByteBuf content) throws Exception {
        if (start instanceof TextWebSocketFrame) {
            return new TextWebSocketFrame(true, start.rsv(), content);
        }

        if (start instanceof BinaryWebSocketFrame) {
            return new BinaryWebSocketFrame(true, start.rsv(), content);
        }

        // Should not reach here.
        throw new Error("Unexpected websocket frame type: " + className(start));
    }
}

Frequently Asked Questions

What is the WebSocketFrameAggregator class?
WebSocketFrameAggregator is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketFrameAggregator.java.
Where is WebSocketFrameAggregator defined?
WebSocketFrameAggregator is defined in codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketFrameAggregator.java at line 31.

Analyze Your Own Codebase

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

Try Supermodel Free