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>
AChannelHandler
that aggregates anBulkStringHeaderRedisMessage
and its followingBulkStringRedisContent
s into a singleFullBulkStringRedisMessage
with no followingBulkStringRedisContent
s. It is useful when you don't want to take care ofRedisMessage
s whose transfer encoding is 'chunked'. Insert this handler afterRedisDecoder
in theChannelPipeline
:ChannelPipeline
p = ...; ... p.addLast("encoder", newRedisEncoder
()); p.addLast("decoder", newRedisDecoder
()); p.addLast("aggregator", newRedisBulkStringAggregator
()); ... p.addLast("handler", new HttpRequestHandler());RedisEncoder
before theRedisBulkStringAggregator
in 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 FullBulkStringRedisMessage
beginAggregation(BulkStringHeaderRedisMessage start, io.netty.buffer.ByteBuf content)
protected boolean
closeAfterContinueResponse(Object msg)
protected boolean
ignoreContentAfterContinueResponse(Object msg)
protected boolean
isAggregated(RedisMessage msg)
protected boolean
isContentLengthInvalid(BulkStringHeaderRedisMessage start, int maxContentLength)
protected boolean
isContentMessage(RedisMessage msg)
protected boolean
isLastContentMessage(BulkStringRedisContent msg)
protected boolean
isStartMessage(RedisMessage msg)
protected Object
newContinueResponse(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:
isStartMessage
in classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>
- Throws:
Exception
-
isContentMessage
protected boolean isContentMessage(RedisMessage msg) throws Exception
- Specified by:
isContentMessage
in classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>
- Throws:
Exception
-
isLastContentMessage
protected boolean isLastContentMessage(BulkStringRedisContent msg) throws Exception
- Specified by:
isLastContentMessage
in classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>
- Throws:
Exception
-
isAggregated
protected boolean isAggregated(RedisMessage msg) throws Exception
- Specified by:
isAggregated
in classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>
- Throws:
Exception
-
isContentLengthInvalid
protected boolean isContentLengthInvalid(BulkStringHeaderRedisMessage start, int maxContentLength) throws Exception
- Specified by:
isContentLengthInvalid
in 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:
newContinueResponse
in classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>
- Throws:
Exception
-
closeAfterContinueResponse
protected boolean closeAfterContinueResponse(Object msg) throws Exception
- Specified by:
closeAfterContinueResponse
in classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>
- Throws:
Exception
-
ignoreContentAfterContinueResponse
protected boolean ignoreContentAfterContinueResponse(Object msg) throws Exception
- Specified by:
ignoreContentAfterContinueResponse
in 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:
beginAggregation
in classio.netty.handler.codec.MessageAggregator<RedisMessage,BulkStringHeaderRedisMessage,BulkStringRedisContent,FullBulkStringRedisMessage>
- Throws:
Exception
-
-