public class StompSubframeAggregator extends MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>
ChannelHandler that aggregates an StompHeadersSubframe
and its following StompContentSubframes into a single StompFrame.
It is useful when you don't want to take care of STOMP frames whose content is 'chunked'. Insert this
handler after StompSubframeDecoder in the ChannelPipeline:ChannelHandler.Sharable| 构造器和说明 |
|---|
StompSubframeAggregator(int maxContentLength)
Creates a new instance.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected StompFrame |
beginAggregation(StompHeadersSubframe start,
ByteBuf content)
Creates a new aggregated message from the specified start message and the specified content.
|
protected boolean |
closeAfterContinueResponse(java.lang.Object msg)
Determine if the channel should be closed after the result of
MessageAggregator.newContinueResponse(Object, int, ChannelPipeline) is written. |
protected boolean |
ignoreContentAfterContinueResponse(java.lang.Object msg)
Determine if all objects for the current request/response should be ignored or not.
|
protected boolean |
isAggregated(StompSubframe msg)
Returns
true if and only if the specified message is already aggregated. |
protected boolean |
isContentLengthInvalid(StompHeadersSubframe start,
int maxContentLength)
Determine if the message
start's content length is known, and if it greater than
maxContentLength. |
protected boolean |
isContentMessage(StompSubframe msg)
Returns
true if and only if the specified message is a content message. |
protected boolean |
isLastContentMessage(StompContentSubframe msg)
Returns
true if and only if the specified message is the last content message. |
protected boolean |
isStartMessage(StompSubframe msg)
Returns
true if and only if the specified message is a start message. |
protected java.lang.Object |
newContinueResponse(StompHeadersSubframe start,
int maxContentLength,
ChannelPipeline pipeline)
Returns the 'continue response' for the specified start message if necessary.
|
acceptInboundMessage, aggregate, channelInactive, channelReadComplete, ctx, decode, finishAggregation, handleOversizedMessage, handlerAdded, handlerRemoved, isHandlingOversizedMessage, maxContentLength, maxCumulationBufferComponents, setMaxCumulationBufferComponentschannelReadchannelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredensureNotSharable, isSharablepublic StompSubframeAggregator(int maxContentLength)
maxContentLength - the maximum length of the aggregated content.
If the length of the aggregated content exceeds this value,
a TooLongFrameException will be raised.protected boolean isStartMessage(StompSubframe msg) throws java.lang.Exception
MessageAggregatortrue if and only if the specified message is a start message. Typically, this method is
implemented as a single return statement with instanceof:
return msg instanceof MyStartMessage;
isStartMessage 在类中 MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>java.lang.Exceptionprotected boolean isContentMessage(StompSubframe msg) throws java.lang.Exception
MessageAggregatortrue if and only if the specified message is a content message. Typically, this method is
implemented as a single return statement with instanceof:
return msg instanceof MyContentMessage;
isContentMessage 在类中 MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>java.lang.Exceptionprotected boolean isLastContentMessage(StompContentSubframe msg) throws java.lang.Exception
MessageAggregatortrue 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();
isLastContentMessage 在类中 MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>java.lang.Exceptionprotected boolean isAggregated(StompSubframe msg) throws java.lang.Exception
MessageAggregatortrue 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.isAggregated 在类中 MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>java.lang.Exceptionprotected boolean isContentLengthInvalid(StompHeadersSubframe start, int maxContentLength)
MessageAggregatorstart's content length is known, and if it greater than
maxContentLength.isContentLengthInvalid 在类中 MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>start - The message which may indicate the content length.maxContentLength - The maximum allowed content length.true if the message start's content length is known, and if it greater than
maxContentLength. false otherwise.protected java.lang.Object newContinueResponse(StompHeadersSubframe start, int maxContentLength, ChannelPipeline pipeline)
MessageAggregatornewContinueResponse 在类中 MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>null if there's no message to sendprotected boolean closeAfterContinueResponse(java.lang.Object msg)
throws java.lang.Exception
MessageAggregatorMessageAggregator.newContinueResponse(Object, int, ChannelPipeline) is written.closeAfterContinueResponse 在类中 MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>msg - The return value from MessageAggregator.newContinueResponse(Object, int, ChannelPipeline).true if the channel should be closed after the result of
MessageAggregator.newContinueResponse(Object, int, ChannelPipeline) is written. false otherwise.java.lang.Exceptionprotected boolean ignoreContentAfterContinueResponse(java.lang.Object msg)
throws java.lang.Exception
MessageAggregatorMessageAggregator.isContentMessage(Object) returns true.ignoreContentAfterContinueResponse 在类中 MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>msg - The return value from MessageAggregator.newContinueResponse(Object, int, ChannelPipeline).true if all objects for the current request/response should be ignored or not.
false otherwise.java.lang.Exceptionprotected StompFrame beginAggregation(StompHeadersSubframe start, ByteBuf content) throws java.lang.Exception
MessageAggregatorByteBufHolder, its content is appended to the specified content.
This aggregator will continue to append the received content to the specified content.beginAggregation 在类中 MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>java.lang.Exception