Class RequestLimitDecoder
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.codec.ByteToMessageDecoder
org.infinispan.server.core.transport.RequestLimitDecoder
- All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler
- Direct Known Subclasses:
BaseRespDecoder, HotRodDecoder, MemcachedBaseDecoder
public abstract class RequestLimitDecoder
extends io.netty.handler.codec.ByteToMessageDecoder
Base for the generated protocol decoders, tracking how many bytes the request being parsed has consumed so that a
maximum content length can be enforced against it.
The count cannot be taken from the reader index alone. A request may be spread over any number of decode
invocations, and the cumulation buffer can be compacted or replaced in between, so the progress each invocation
makes is folded into a counter instead. startRequest(ByteBuf), which the grammars invoke at the start of
every request, clears that counter, so the bytes of a preceding pipelined request are never charged against the
request that follows it.
- Since:
- 16.3
-
Nested Class Summary
Nested classes/interfaces inherited from class io.netty.handler.codec.ByteToMessageDecoder
io.netty.handler.codec.ByteToMessageDecoder.CumulatorNested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
FieldsFields inherited from class io.netty.handler.codec.ByteToMessageDecoder
COMPOSITE_CUMULATOR, MERGE_CUMULATOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intbytesAvailable(io.netty.buffer.ByteBuf buf) protected voidcallDecode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, List<Object> out) intNumber of bytes consumed so far by the request currently being parsed, for reporting only.final intprotected voidstartRequest(io.netty.buffer.ByteBuf buf) Invoked when the parser starts reading a new request, so that the bytes of the request preceding it in the pipeline are not charged against it.Methods inherited from class io.netty.handler.codec.ByteToMessageDecoder
actualReadableBytes, channelInactive, channelRead, channelReadComplete, decode, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggeredMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded
-
Field Details
-
maxContentLength
protected final int maxContentLength
-
-
Constructor Details
-
RequestLimitDecoder
protected RequestLimitDecoder(int maxContentLength, int unlimited)
-
-
Method Details
-
maxContentLength
public final int maxContentLength() -
callDecode
-
startRequest
protected void startRequest(io.netty.buffer.ByteBuf buf) Invoked when the parser starts reading a new request, so that the bytes of the request preceding it in the pipeline are not charged against it. -
bytesAvailable
protected int bytesAvailable(io.netty.buffer.ByteBuf buf) -
currentRequestBytes
public int currentRequestBytes()Number of bytes consumed so far by the request currently being parsed, for reporting only. PreferbytesAvailable(ByteBuf): this is here for the generated header and error handling methods, which have no buffer parameter. With no buffer being decoded it reports the count as of the last decode invocation.
-