Package io.netty.handler.codec.redis
Class RedisBulkStringAggregator
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.handler.codec.MessageToMessageDecoder<I>
-
- io.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>
-
- io.netty.handler.codec.redis.RedisBulkStringAggregator
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
@UnstableApi public final class RedisBulkStringAggregator extends io.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>
AChannelHandlerthat aggregates anBulkStringHeaderRedisMessageand its followingBulkStringRedisContents into a singleFullBulkStringRedisMessagewith no followingBulkStringRedisContents. It is useful when you don't want to take care ofRedisMessages whose transfer encoding is 'chunked'. Insert this handler afterRedisDecoderin theChannelPipeline:
Be aware that you need to have theChannelPipelinep = ...; ... p.addLast("encoder", newRedisEncoder()); p.addLast("decoder", newRedisDecoder()); p.addLast("aggregator", newRedisBulkStringAggregator()); ... p.addLast("handler", new HttpRequestHandler());RedisEncoderbefore theRedisBulkStringAggregatorin theChannelPipeline.
-
-
Constructor Summary
Constructors Constructor Description RedisBulkStringAggregator()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FullBulkStringRedisMessagebeginAggregation(BulkStringHeaderRedisMessage start, io.netty.buffer.ByteBuf content)protected booleancloseAfterContinueResponse(Object msg)protected booleanignoreContentAfterContinueResponse(Object msg)protected booleanisAggregated(RedisMessage msg)protected booleanisContentLengthInvalid(BulkStringHeaderRedisMessage start, int maxContentLength)protected booleanisContentMessage(RedisMessage msg)protected booleanisLastContentMessage(BulkStringRedisContent msg)protected booleanisStartMessage(RedisMessage msg)protected ObjectnewContinueResponse(BulkStringHeaderRedisMessage start, int maxContentLength, io.netty.channel.ChannelPipeline pipeline)-
Methods inherited from class io.netty.handler.codec.MessageAggregator
acceptInboundMessage, aggregate, channelInactive, channelReadComplete, ctx, decode, finishAggregation, handleOversizedMessage, handlerAdded, handlerRemoved, isHandlingOversizedMessage, maxContentLength, maxCumulationBufferComponents, releaseCurrentMessage, setMaxCumulationBufferComponents
-
-
-
-
Method Detail
-
isStartMessage
protected boolean isStartMessage(RedisMessage msg) throws Exception
- Specified by:
isStartMessagein classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>- Throws:
Exception
-
isContentMessage
protected boolean isContentMessage(RedisMessage msg) throws Exception
- Specified by:
isContentMessagein classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>- Throws:
Exception
-
isLastContentMessage
protected boolean isLastContentMessage(BulkStringRedisContent msg) throws Exception
- Specified by:
isLastContentMessagein classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>- Throws:
Exception
-
isAggregated
protected boolean isAggregated(RedisMessage msg) throws Exception
- Specified by:
isAggregatedin classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>- Throws:
Exception
-
isContentLengthInvalid
protected boolean isContentLengthInvalid(BulkStringHeaderRedisMessage start, int maxContentLength) throws Exception
- Specified by:
isContentLengthInvalidin classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>- Throws:
Exception
-
newContinueResponse
protected Object newContinueResponse(BulkStringHeaderRedisMessage start, int maxContentLength, io.netty.channel.ChannelPipeline pipeline) throws Exception
- Specified by:
newContinueResponsein classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>- Throws:
Exception
-
closeAfterContinueResponse
protected boolean closeAfterContinueResponse(Object msg) throws Exception
- Specified by:
closeAfterContinueResponsein classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>- Throws:
Exception
-
ignoreContentAfterContinueResponse
protected boolean ignoreContentAfterContinueResponse(Object msg) throws Exception
- Specified by:
ignoreContentAfterContinueResponsein classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>- Throws:
Exception
-
beginAggregation
protected FullBulkStringRedisMessage beginAggregation(BulkStringHeaderRedisMessage start, io.netty.buffer.ByteBuf content) throws Exception
- Specified by:
beginAggregationin classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>- Throws:
Exception
-
-