Top Description Constructors Methods
io.netty5.handler.codec.http.websocketx

public Class WebSocketFrameAggregator

extends MessageAggregator<WebSocketFrame, WebSocketFrame, ContinuationWebSocketFrame, WebSocketFrame>
Class Inheritance
Imports
io.netty5.buffer.BufferAllocator, .CompositeBuffer, io.netty5.channel.ChannelPipeline, io.netty5.handler.codec.MessageAggregator, .TooLongFrameException

Handler that aggregate fragmented WebSocketFrame's. Be aware if PING/PONG/CLOSE frames are send in the middle of a fragmented WebSocketFrame they will just get forwarded to the next handler in the pipeline.

Constructor Summary

AccessConstructor and Description
public
WebSocketFrameAggregator(int
If the size of the aggregated frame exceeds this value, a TooLongFrameException is thrown.
maxContentLength
)

Creates a new instance

Method Summary

Modifier and TypeMethod and Description
protected void
aggregate(BufferAllocator allocator, WebSocketFrame aggregated, ContinuationWebSocketFrame content)

Implements abstract io.netty5.handler.codec.MessageAggregator.aggregate.

Aggregated the passed content in the passed aggregate.
protected WebSocketFrame
beginAggregation(BufferAllocator allocator, WebSocketFrame start)

Implements abstract io.netty5.handler.codec.MessageAggregator.beginAggregation.

Creates a new aggregated message from the specified start message.
protected boolean
protected boolean
ignoreContentAfterContinueResponse(Object msg)

Implements abstract io.netty5.handler.codec.MessageAggregator.ignoreContentAfterContinueResponse.

Determine if all objects for the current request/response should be ignored or not.
protected boolean
isAggregated(Object msg)

Implements abstract io.netty5.handler.codec.MessageAggregator.isAggregated.

Returns true if and only if the specified message is already aggregated.
protected boolean
isContentLengthInvalid(WebSocketFrame
The message which may indicate the content length.
start
,
int
The maximum allowed content length.
maxContentLength
)

Implements abstract io.netty5.handler.codec.MessageAggregator.isContentLengthInvalid.

Determine if the message start's content length is known, and if it greater than maxContentLength.
private static boolean
protected boolean
isLastContentMessage(ContinuationWebSocketFrame msg)

Implements abstract io.netty5.handler.codec.MessageAggregator.isLastContentMessage.

Returns true if and only if the specified message is the last content message.
private static boolean
protected int
lengthForAggregation(WebSocketFrame
to calculate length.
msg
)

Implements abstract io.netty5.handler.codec.MessageAggregator.lengthForAggregation.

Returns the length in bytes of the passed message.
protected int
lengthForContent(ContinuationWebSocketFrame
to calculate length.
msg
)

Implements abstract io.netty5.handler.codec.MessageAggregator.lengthForContent.

Returns the length in bytes of the passed message.
protected Object
newContinueResponse(WebSocketFrame start, int maxContentLength, ChannelPipeline pipeline)

Implements abstract io.netty5.handler.codec.MessageAggregator.newContinueResponse.

Returns the 'continue response' for the specified start message if necessary.
protected ContinuationWebSocketFrame
tryContentMessage(Object msg)

Implements abstract io.netty5.handler.codec.MessageAggregator.tryContentMessage.

If the passed msg is a content message then cast and return the same, else return null.
protected WebSocketFrame
tryStartMessage(Object msg)

Implements abstract io.netty5.handler.codec.MessageAggregator.tryStartMessage.

If the passed msg is a start message then cast and return the same, else return null.
Inherited from io.netty5.handler.codec.MessageAggregator:
acceptInboundMessagechannelInactivechannelReadCompletectxdecodefinishAggregationhandleOversizedMessagehandlerAddedhandlerRemovedmaxContentLength

Constructor Detail

WebSocketFrameAggregatorback to summary
public WebSocketFrameAggregator(int maxContentLength)

Creates a new instance

Parameters
maxContentLength:int

If the size of the aggregated frame exceeds this value, a TooLongFrameException is thrown.

Method Detail

aggregateback to summary
protected void aggregate(BufferAllocator allocator, WebSocketFrame aggregated, ContinuationWebSocketFrame content) throws Exception

Implements abstract io.netty5.handler.codec.MessageAggregator.aggregate.

Doc from io.netty5.handler.codec.MessageAggregator.aggregate.

Aggregated the passed content in the passed aggregate.

Annotations
@Override
beginAggregationback to summary
protected WebSocketFrame beginAggregation(BufferAllocator allocator, WebSocketFrame start)

Implements abstract io.netty5.handler.codec.MessageAggregator.beginAggregation.

Doc from io.netty5.handler.codec.MessageAggregator.beginAggregation.

Creates a new aggregated message from the specified start message.

Annotations
@Override
closeAfterContinueResponseback to summary
protected boolean closeAfterContinueResponse(Object msg) throws Exception

Implements abstract io.netty5.handler.codec.MessageAggregator.closeAfterContinueResponse.

Doc from io.netty5.handler.codec.MessageAggregator.closeAfterContinueResponse.

Determine if the channel should be closed after the result of newContinueResponse(Object, int, ChannelPipeline) is written.

Parameters
msg:Object

The return value from newContinueResponse(Object, int, ChannelPipeline).

Returns:boolean

true if the channel should be closed after the result of newContinueResponse(Object, int, ChannelPipeline) is written. false otherwise.

Annotations
@Override
ignoreContentAfterContinueResponseback to summary
protected boolean ignoreContentAfterContinueResponse(Object msg) throws Exception

Implements abstract io.netty5.handler.codec.MessageAggregator.ignoreContentAfterContinueResponse.

Doc from io.netty5.handler.codec.MessageAggregator.ignoreContentAfterContinueResponse.

Determine if all objects for the current request/response should be ignored or not. Messages will stop being ignored the next time tryContentMessage(Object) returns a non null value.

Parameters
msg:Object

The return value from newContinueResponse(Object, int, ChannelPipeline).

Returns:boolean

true if all objects for the current request/response should be ignored or not. false otherwise.

Annotations
@Override
isAggregatedback to summary
protected boolean isAggregated(Object msg) throws Exception

Implements abstract io.netty5.handler.codec.MessageAggregator.isAggregated.

Doc from io.netty5.handler.codec.MessageAggregator.isAggregated.

Returns true if and only if the specified message is already aggregated. If this method returns true, this handler will simply forward the message to the next handler as-is.

Annotations
@Override
isContentLengthInvalidback to summary
protected boolean isContentLengthInvalid(WebSocketFrame start, int maxContentLength)

Implements abstract io.netty5.handler.codec.MessageAggregator.isContentLengthInvalid.

Doc from io.netty5.handler.codec.MessageAggregator.isContentLengthInvalid.

Determine if the message start's content length is known, and if it greater than maxContentLength.

Parameters
start:WebSocketFrame

The message which may indicate the content length.

maxContentLength:int

The maximum allowed content length.

Returns:boolean

true if the message start's content length is known, and if it greater than maxContentLength. false otherwise.

Annotations
@Override
isContentMessageback to summary
private static boolean isContentMessage(Object msg)
isLastContentMessageback to summary
protected boolean isLastContentMessage(ContinuationWebSocketFrame msg)

Implements abstract io.netty5.handler.codec.MessageAggregator.isLastContentMessage.

Doc from io.netty5.handler.codec.MessageAggregator.isLastContentMessage.

Returns true if and only if the specified message is the last content message. Typically, this method is implemented as a single return statement with instanceof:

return msg instanceof MyLastContentMessage;
or with instanceof and boolean field check:
return msg instanceof MyContentMessage && msg.isLastFragment();
Annotations
@Override
isStartMessageback to summary
private static boolean isStartMessage(Object msg)
lengthForAggregationback to summary
protected int lengthForAggregation(WebSocketFrame msg)

Implements abstract io.netty5.handler.codec.MessageAggregator.lengthForAggregation.

Doc from io.netty5.handler.codec.MessageAggregator.lengthForAggregation.

Returns the length in bytes of the passed message.

Parameters
msg:WebSocketFrame

to calculate length.

Returns:int

Length in bytes of the passed message.

Annotations
@Override
lengthForContentback to summary
protected int lengthForContent(ContinuationWebSocketFrame msg)

Implements abstract io.netty5.handler.codec.MessageAggregator.lengthForContent.

Doc from io.netty5.handler.codec.MessageAggregator.lengthForContent.

Returns the length in bytes of the passed message.

Parameters
msg:ContinuationWebSocketFrame

to calculate length.

Returns:int

Length in bytes of the passed message.

Annotations
@Override
newContinueResponseback to summary
protected Object newContinueResponse(WebSocketFrame start, int maxContentLength, ChannelPipeline pipeline)

Implements abstract io.netty5.handler.codec.MessageAggregator.newContinueResponse.

Doc from io.netty5.handler.codec.MessageAggregator.newContinueResponse.

Returns the 'continue response' for the specified start message if necessary. For example, this method is useful to handle an HTTP 100-continue header.

Returns:Object

the 'continue response', or null if there's no message to send

Annotations
@Override
tryContentMessageback to summary
protected ContinuationWebSocketFrame tryContentMessage(Object msg)

Implements abstract io.netty5.handler.codec.MessageAggregator.tryContentMessage.

Doc from io.netty5.handler.codec.MessageAggregator.tryContentMessage.

If the passed msg is a content message then cast and return the same, else return null.

Annotations
@Override
tryStartMessageback to summary
protected WebSocketFrame tryStartMessage(Object msg)

Implements abstract io.netty5.handler.codec.MessageAggregator.tryStartMessage.

Doc from io.netty5.handler.codec.MessageAggregator.tryStartMessage.

If the passed msg is a start message then cast and return the same, else return null.

Annotations
@Override