ByteBufHolder)
S and ByteBufHolder)
ChannelHandler that aggregates a series of message objects into a single aggregated message.
'A series of messages' is composed of the following:
isLastContentMessage(ByteBufHolder)
return true for, the aggregator will finish the aggregation and produce the aggregated message and expect
another start message.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private ChannelFutureListener | |
| private ChannelHandlerContext | |
| private O | |
| private static final int | |
| private boolean | |
| private boolean | |
| private final int | |
| private int |
| Access | Constructor and Description |
|---|---|
| protected | MessageAggregator(int
the maximum length of the aggregated content.
If the length of the aggregated content exceeds this value,
maxContentLength)handleOversizedMessage(ChannelHandlerContext, Object) will be called.Creates a new instance. |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | acceptInboundMessage(Object msg)
Overrides io. true if the given message should be handled.
|
| protected void | aggregate(O aggregated, C content)
Transfers the information provided by the specified content message to the specified aggregated message. |
| private static void | |
| protected abstract O | beginAggregation(S start, ByteBuf content)
Creates a new aggregated message from the specified start message and the specified content. |
| public void | channelInactive(ChannelHandlerContext ctx)
Overrides io. Implements io. ChannelHandlerContext#fireChannelInactive() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
|
| public void | channelReadComplete(ChannelHandlerContext ctx)
Overrides io. Implements io. ChannelHandlerContext#fireChannelReadComplete() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
|
| protected abstract boolean | Returns: true if the channel should be closed after the result of
newContinueResponse(Object, int, ChannelPipeline) is written. false otherwise.The return value from msg)newContinueResponse(Object, int, ChannelPipeline).Determine if the channel should be closed after the result of
|
| protected final ChannelHandlerContext | |
| protected void | decode(final ChannelHandlerContext
the ctx, I ChannelHandlerContext which this MessageToMessageDecoder belongs tothe message to decode to an other one msg, List<Object> the out)List to which decoded messages should be addedImplements abstract io. |
| protected void | finishAggregation(O aggregated)
Invoked when the specified |
| private void | |
| protected void | handleOversizedMessage(ChannelHandlerContext ctx, S
the accumulated message up to this point, whose type is oversized)S or OInvoked when an incoming request exceeds the maximum content length. |
| public void | handlerAdded(ChannelHandlerContext ctx)
Overrides io. Implements io. ChannelHandler was added to the actual context and it's ready to handle events.
|
| public void | handlerRemoved(ChannelHandlerContext ctx)
Overrides io. Implements io. ChannelHandler was removed from the actual context and it doesn't handle events
anymore.
|
| protected abstract boolean | Returns: true if all objects for the current request/response should be ignored or not.
false otherwise.The return value from msg)newContinueResponse(Object, int, ChannelPipeline).Determine if all objects for the current request/response should be ignored or not. |
| private void | |
| protected abstract boolean | |
| protected abstract boolean | Returns: true if the message start's content length is known, and if it greater than
maxContentLength. false otherwise.The message which may indicate the content length. start, int The maximum allowed content length. maxContentLength)Determine if the message |
| protected abstract boolean | |
| public final boolean | |
| protected abstract boolean | isLastContentMessage(C msg)
Returns |
| protected abstract boolean | |
| public final int | |
| public final int | |
| protected abstract Object | Returns: the 'continue response', ornull if there's no message to sendReturns the 'continue response' for the specified start message if necessary. |
| private void | |
| public final void | setMaxCumulationBufferComponents(int maxCumulationBufferComponents)
Sets the maximum number of components in the cumulation buffer. |
| private static void |
| aggregating | back to summary |
|---|---|
| private boolean aggregating | |
| continueResponseWriteListener | back to summary |
|---|---|
| private ChannelFutureListener continueResponseWriteListener | |
| ctx | back to summary |
|---|---|
| private ChannelHandlerContext ctx | |
| currentMessage | back to summary |
|---|---|
| private O currentMessage | |
| DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS | back to summary |
|---|---|
| private static final int DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS | |
| handleIncompleteAggregateDuringClose | back to summary |
|---|---|
| private boolean handleIncompleteAggregateDuringClose | |
| handlingOversizedMessage | back to summary |
|---|---|
| private boolean handlingOversizedMessage | |
| maxContentLength | back to summary |
|---|---|
| private final int maxContentLength | |
| maxCumulationBufferComponents | back to summary |
|---|---|
| private int maxCumulationBufferComponents | |
| MessageAggregator | back to summary |
|---|---|
| protected MessageAggregator(int maxContentLength) Creates a new instance.
| |
| MessageAggregator | back to summary |
|---|---|
| protected MessageAggregator(int maxContentLength, Class<? extends I> inboundMessageType) | |
| acceptInboundMessage | back to summary |
|---|---|
| public boolean acceptInboundMessage(Object msg) throws Exception Overrides io. Doc from io. Returns
| |
| aggregate | back to summary |
|---|---|
| protected void aggregate(O aggregated, C content) throws Exception Transfers the information provided by the specified content message to the specified aggregated message.
Note that the content of the specified content message has been appended to the content of the specified
aggregated message already, so that you don't need to. Use this method to transfer the additional information
that the content message provides to | |
| appendPartialContent | back to summary |
|---|---|
| private static void appendPartialContent(CompositeByteBuf content, ByteBuf partialContent) | |
| beginAggregation | back to summary |
|---|---|
| protected abstract O beginAggregation(S start, ByteBuf content) throws Exception Creates a new aggregated message from the specified start message and the specified content. If the start
message implements | |
| channelInactive | back to summary |
|---|---|
| public void channelInactive(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Calls
| |
| channelReadComplete | back to summary |
|---|---|
| public void channelReadComplete(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Calls
| |
| closeAfterContinueResponse | back to summary |
|---|---|
| protected abstract boolean closeAfterContinueResponse(Object msg) throws Exception Determine if the channel should be closed after the result of
| |
| ctx | back to summary |
|---|---|
| protected final ChannelHandlerContext ctx() | |
| decode | back to summary |
|---|---|
| protected void decode(final ChannelHandlerContext ctx, I msg, List<Object> out) throws Exception Implements abstract io. Doc from io. Decode from one message to an other. This method will be called for each written message that can be handled by this decoder.
| |
| finishAggregation | back to summary |
|---|---|
| protected void finishAggregation(O aggregated) throws Exception Invoked when the specified | |
| finishAggregation0 | back to summary |
|---|---|
| private void finishAggregation0(O aggregated) throws Exception | |
| handleOversizedMessage | back to summary |
|---|---|
| protected void handleOversizedMessage(ChannelHandlerContext ctx, S oversized) throws Exception Invoked when an incoming request exceeds the maximum content length. The default behvaior is to trigger an
| |
| handlerAdded | back to summary |
|---|---|
| public void handlerAdded(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Gets called after the
| |
| handlerRemoved | back to summary |
|---|---|
| public void handlerRemoved(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Gets called after the
| |
| ignoreContentAfterContinueResponse | back to summary |
|---|---|
| protected abstract boolean ignoreContentAfterContinueResponse(Object msg) throws Exception Determine if all objects for the current request/response should be ignored or not.
Messages will stop being ignored the next time
| |
| invokeHandleOversizedMessage | back to summary |
|---|---|
| private void invokeHandleOversizedMessage(ChannelHandlerContext ctx, S oversized) throws Exception | |
| isAggregated | back to summary |
|---|---|
| protected abstract boolean isAggregated(I msg) throws Exception Returns | |
| isContentLengthInvalid | back to summary |
|---|---|
| protected abstract boolean isContentLengthInvalid(S start, int maxContentLength) throws Exception Determine if the message
| |
| isContentMessage | back to summary |
|---|---|
| protected abstract boolean isContentMessage(I msg) throws Exception Returns return msg instanceof MyContentMessage; | |
| isHandlingOversizedMessage | back to summary |
|---|---|
| public final boolean isHandlingOversizedMessage()
Deprecated This method will be removed in future releases.
| |
| isLastContentMessage | back to summary |
|---|---|
| protected abstract boolean isLastContentMessage(C msg) throws Exception Returns return msg instanceof MyLastContentMessage;or with instanceof and boolean field check:
return msg instanceof MyContentMessage && msg.isLastFragment(); | |
| isStartMessage | back to summary |
|---|---|
| protected abstract boolean isStartMessage(I msg) throws Exception Returns return msg instanceof MyStartMessage; | |
| maxContentLength | back to summary |
|---|---|
| public final int maxContentLength() Returns the maximum allowed length of the aggregated message in bytes. | |
| maxCumulationBufferComponents | back to summary |
|---|---|
| public final int maxCumulationBufferComponents() Returns the maximum number of components in the cumulation buffer. If the number of the components in the cumulation buffer exceeds this value, the components of the cumulation buffer are consolidated into a single component, involving memory copies. The default value of this property is 1024. | |
| newContinueResponse | back to summary |
|---|---|
| protected abstract Object newContinueResponse(S start, int maxContentLength, ChannelPipeline pipeline) throws Exception Returns the 'continue response' for the specified start message if necessary. For example, this method is useful to handle an HTTP 100-continue header.
| |
| releaseCurrentMessage | back to summary |
|---|---|
| private void releaseCurrentMessage() | |
| setMaxCumulationBufferComponents | back to summary |
|---|---|
| public final void setMaxCumulationBufferComponents(int maxCumulationBufferComponents) Sets the maximum number of components in the cumulation buffer. If the number of
the components in the cumulation buffer exceeds this value, the components of the
cumulation buffer are consolidated into a single component, involving memory copies.
The default value of this property is 1024
and its minimum allowed value is | |
| validateMaxContentLength | back to summary |
|---|---|
| private static void validateMaxContentLength(int maxContentLength) | |