public class StompSubframeAggregator extends MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>
ChannelHandler ,其将StompHeadersSubframe及其后续StompContentSubframe汇总为单个StompFrame 。
当您不想处理内容被“分块”的STOMP帧时,它非常有用。
插入此处理后StompSubframeDecoder在ChannelPipeline :
ChannelHandler.Sharable| Constructor and Description |
|---|
StompSubframeAggregator(int maxContentLength)
创建一个新的实例。
|
| Modifier and Type | Method and Description |
|---|---|
protected StompFrame |
beginAggregation(StompHeadersSubframe start, ByteBuf content)
根据指定的开始消息和指定的内容创建新的聚合消息。
|
protected boolean |
closeAfterContinueResponse(java.lang.Object msg)
在写入
MessageAggregator.newContinueResponse(Object, int, ChannelPipeline)的结果之后,确定通道是否应该关闭。
|
protected boolean |
ignoreContentAfterContinueResponse(java.lang.Object msg)
确定当前请求/响应的所有对象是否应该被忽略。
|
protected boolean |
isAggregated(StompSubframe msg)
当且仅当指定的消息已经聚合时才返回
true 。
|
protected boolean |
isContentLengthInvalid(StompHeadersSubframe start, int maxContentLength)
确定消息
start的内容长度是否已知,并且是否大于
maxContentLength 。
|
protected boolean |
isContentMessage(StompSubframe msg)
当且仅当指定的消息是内容消息时才返回
true 。
|
protected boolean |
isLastContentMessage(StompContentSubframe msg)
当且仅当指定的消息是最后一个内容消息时返回
true 。
|
protected boolean |
isStartMessage(StompSubframe msg)
当且仅当指定的消息是开始消息时返回
true 。
|
protected java.lang.Object |
newContinueResponse(StompHeadersSubframe start, int maxContentLength, ChannelPipeline pipeline)
如有必要,返回指定开始消息的'continue response'。
|
acceptInboundMessage, aggregate, channelInactive, channelReadComplete, ctx, decode, finishAggregation, handleOversizedMessage, handlerAdded, handlerRemoved, isHandlingOversizedMessage, maxContentLength, maxCumulationBufferComponents, setMaxCumulationBufferComponentschannelReadchannelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredensureNotSharable, isSharablepublic StompSubframeAggregator(int maxContentLength)
maxContentLength - 聚合内容的最大长度。
如果聚合内容的长度超过此值,则会引发TooLongFrameException 。
protected boolean isStartMessage(StompSubframe msg) throws java.lang.Exception
MessageAggregator
true 。
通常,这种方法是作为一个return声明与instanceof :
return msg instanceof MyStartMessage;
isStartMessage在课堂上
MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>
java.lang.Exception
protected boolean isContentMessage(StompSubframe msg) throws java.lang.Exception
MessageAggregator
true 。
通常,这种方法是作为一个return声明与instanceof :
return msg instanceof MyContentMessage;
isContentMessage在课堂上
MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>
java.lang.Exception
protected boolean isLastContentMessage(StompContentSubframe msg) throws java.lang.Exception
MessageAggregator
true 。
通常,这种方法是作为一个return声明与instanceof :
return msg instanceof MyLastContentMessage;
或与instanceof和布尔字段检查:
return msg instanceof MyContentMessage && msg.isLastFragment();
isLastContentMessage在课堂上
MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>
java.lang.Exception
protected boolean isAggregated(StompSubframe msg) throws java.lang.Exception
MessageAggregator
true 。
如果此方法返回true ,则此处理程序将仅将消息按true转发给下一个处理程序。
isAggregated在课堂上
MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>
java.lang.Exception
protected boolean isContentLengthInvalid(StompHeadersSubframe start, int maxContentLength)
MessageAggregator
start的内容长度是否已知,以及是否大于
maxContentLength 。
isContentLengthInvalid在课程
MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>
start - 可能指示内容长度的消息。
maxContentLength - 允许的最大内容长度。
true如果消息start的内容长度已知,并且它大于maxContentLength 。
false否则。
protected java.lang.Object newContinueResponse(StompHeadersSubframe start, int maxContentLength, ChannelPipeline pipeline)
MessageAggregator
newContinueResponse在课堂上
MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>
null如果没有消息要发送
protected boolean closeAfterContinueResponse(java.lang.Object msg)
throws java.lang.Exception
MessageAggregator
MessageAggregator.newContinueResponse(Object, int, ChannelPipeline)的结果后,确定通道是否应该关闭。
closeAfterContinueResponse在课堂
MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>
msg - 从
MessageAggregator.newContinueResponse(Object, int, ChannelPipeline)返回的值。
true如果在写入MessageAggregator.newContinueResponse(Object, int, ChannelPipeline)的结果后关闭通道。
false否则。
java.lang.Exception
protected boolean ignoreContentAfterContinueResponse(java.lang.Object msg)
throws java.lang.Exception
MessageAggregator
MessageAggregator.isContentMessage(Object)返回true时,消息将不再被忽略。
ignoreContentAfterContinueResponse在课程
MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>
msg -从返回值
MessageAggregator.newContinueResponse(Object, int, ChannelPipeline) 。
true如果当前请求/响应的所有对象都应该被忽略。
false否则。
java.lang.Exception
protected StompFrame beginAggregation(StompHeadersSubframe start, ByteBuf content) throws java.lang.Exception
MessageAggregator
beginAggregation在课程
MessageAggregator<StompSubframe,StompHeadersSubframe,StompContentSubframe,StompFrame>
java.lang.Exception
Copyright © 2008–2018 The Netty Project. All rights reserved.