public class HAProxyMessageDecoder extends ByteToMessageDecoder
ByteToMessageDecoder.Cumulator
ChannelHandler.Sharable
COMPOSITE_CUMULATOR, MERGE_CUMULATOR
构造器和说明 |
---|
HAProxyMessageDecoder()
Creates a new decoder with no additional data (TLV) restrictions, and should throw an exception as soon as
we exceed maxLength.
|
HAProxyMessageDecoder(boolean failFast)
Creates a new decoder with no additional data (TLV) restrictions, whether or not to throw an exception as soon
as we exceed maxLength.
|
HAProxyMessageDecoder(int maxTlvSize)
Creates a new decoder with restricted additional data (TLV) size, and should throw an exception as soon as
we exceed maxLength.
|
HAProxyMessageDecoder(int maxTlvSize,
boolean failFast)
Creates a new decoder with restricted additional data (TLV) size, whether or not to throw an exception as soon
as we exceed maxLength.
|
限定符和类型 | 方法和说明 |
---|---|
void |
channelRead(ChannelHandlerContext ctx,
java.lang.Object msg)
Calls
ChannelHandlerContext.fireChannelRead(Object) to forward
to the next ChannelInboundHandler in the ChannelPipeline . |
protected void |
decode(ChannelHandlerContext ctx,
ByteBuf in,
java.util.List<java.lang.Object> out)
Decode the from one
ByteBuf to an other. |
static ProtocolDetectionResult<HAProxyProtocolVersion> |
detectProtocol(ByteBuf buffer)
Returns the
ProtocolDetectionResult for the given ByteBuf . |
boolean |
isSingleDecode()
If
true then only one message is decoded on each
ByteToMessageDecoder.channelRead(ChannelHandlerContext, Object) call. |
actualReadableBytes, callDecode, channelInactive, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
ensureNotSharable, handlerAdded, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded
public HAProxyMessageDecoder()
public HAProxyMessageDecoder(boolean failFast)
failFast
- Whether or not to throw an exception as soon as we exceed maxLengthpublic HAProxyMessageDecoder(int maxTlvSize)
Note: limiting TLV size only affects processing of v2, binary headers. Also, as allowed by the 1.5 spec
TLV data is currently ignored. For maximum performance it would be best to configure your upstream proxy host to
NOT send TLV data and instantiate with a max TLV size of 0
.
maxTlvSize
- maximum number of bytes allowed for additional data (Type-Length-Value vectors) in a v2 headerpublic HAProxyMessageDecoder(int maxTlvSize, boolean failFast)
maxTlvSize
- maximum number of bytes allowed for additional data (Type-Length-Value vectors) in a v2 headerfailFast
- Whether or not to throw an exception as soon as we exceed maxLengthpublic boolean isSingleDecode()
ByteToMessageDecoder
true
then only one message is decoded on each
ByteToMessageDecoder.channelRead(ChannelHandlerContext, Object)
call.
Default is false
as this has performance impacts.isSingleDecode
在类中 ByteToMessageDecoder
public void channelRead(ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelRead(Object)
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.channelRead
在接口中 ChannelInboundHandler
channelRead
在类中 ByteToMessageDecoder
java.lang.Exception
protected final void decode(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out) throws java.lang.Exception
ByteToMessageDecoder
ByteBuf
to an other. This method will be called till either the input
ByteBuf
has nothing to read when return from this method or till nothing was read from the input
ByteBuf
.decode
在类中 ByteToMessageDecoder
ctx
- the ChannelHandlerContext
which this ByteToMessageDecoder
belongs toin
- the ByteBuf
from which to read dataout
- the List
to which decoded messages should be addedjava.lang.Exception
- is thrown if an error occurspublic static ProtocolDetectionResult<HAProxyProtocolVersion> detectProtocol(ByteBuf buffer)
ProtocolDetectionResult
for the given ByteBuf
.