Top Description Inners Fields Constructors Methods
io.netty5.handler.codec.http.websocketx

public Class WebSocket13FrameDecoder

extends ByteToMessageDecoder
implements WebSocketFrameDecoder
Class Inheritance
All Implemented Interfaces
io.netty5.handler.codec.http.websocketx.WebSocketFrameDecoder, io.netty5.channel.ChannelHandler
Imports
io.netty5.buffer.Buffer, io.netty5.channel.ChannelFutureListeners, .ChannelHandlerContext, io.netty5.handler.codec.ByteToMessageDecoder, .TooLongFrameException, io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, java.util.Objects

Decodes a web socket frame from wire protocol version 13 format. V13 is essentially the same as V8.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum

Field Summary

Modifier and TypeField and Description
private final WebSocketDecoderConfig
private int
private boolean
private boolean
private int
private int
private long
private int
private static final InternalLogger
private byte[]
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private static final byte
private boolean
private WebSocket13FrameDecoder.State
Inherited from io.netty5.handler.codec.ByteToMessageDecoder:
COMPOSITE_CUMULATORMERGE_CUMULATOR

Constructor Summary

AccessConstructor and Description
public
WebSocket13FrameDecoder(boolean
Web socket servers must set this to true processed incoming masked payload. Client implementations must set this to false.
expectMaskedFrames
,
boolean
Flag to allow reserved extension bits to be used or not
allowExtensions
,
int
Maximum length of a frame's payload. Setting this to an appropriate value for you application helps check for denial of services attacks.
maxFramePayloadLength
)

Constructor

public
WebSocket13FrameDecoder(boolean
Web socket servers must set this to true processed incoming masked payload. Client implementations must set this to false.
expectMaskedFrames
,
boolean
Flag to allow reserved extension bits to be used or not
allowExtensions
,
int
Maximum length of a frame's payload. Setting this to an appropriate value for you application helps check for denial of services attacks.
maxFramePayloadLength
,
boolean
When set to true, frames which are not masked properly according to the standard will still be accepted.
allowMaskMismatch
)

Constructor

public
WebSocket13FrameDecoder(WebSocketDecoderConfig
Frames decoder configuration.
decoderConfig
)

Constructor

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
decode(ChannelHandlerContext ctx, Buffer
the Buffer from which to read data
in
)

Implements abstract io.netty5.handler.codec.ByteToMessageDecoder.decode.

Decode the from one Buffer to another.
private void
private void
private void
private static int
toFrameLength(long length)

private void
unmask(Buffer frame)

Inherited from io.netty5.handler.codec.ByteToMessageDecoder:
actualReadableByteschannelInactivechannelReadchannelReadCompletechannelShutdowndecodeLastdiscardSomeReadByteshandlerAddedhandlerAdded0handlerRemovedhandlerRemoved0internalBufferisSharableisSingleDecodesetSingleDecode

Field Detail

configback to summary
private final WebSocketDecoderConfig config
fragmentedFramesCountback to summary
private int fragmentedFramesCount
frameFinalFlagback to summary
private boolean frameFinalFlag
frameMaskedback to summary
private boolean frameMasked
frameOpcodeback to summary
private int frameOpcode
framePayloadLen1back to summary
private int framePayloadLen1
framePayloadLengthback to summary
private long framePayloadLength
frameRsvback to summary
private int frameRsv
loggerback to summary
private static final InternalLogger logger
maskingKeyback to summary
private byte[] maskingKey
OPCODE_BINARYback to summary
private static final byte OPCODE_BINARY
OPCODE_CLOSEback to summary
private static final byte OPCODE_CLOSE
OPCODE_CONTback to summary
private static final byte OPCODE_CONT
OPCODE_PINGback to summary
private static final byte OPCODE_PING
OPCODE_PONGback to summary
private static final byte OPCODE_PONG
OPCODE_TEXTback to summary
private static final byte OPCODE_TEXT
receivedClosingHandshakeback to summary
private boolean receivedClosingHandshake
stateback to summary
private WebSocket13FrameDecoder.State state

Constructor Detail

WebSocket13FrameDecoderback to summary
public WebSocket13FrameDecoder(boolean expectMaskedFrames, boolean allowExtensions, int maxFramePayloadLength)

Constructor

Parameters
expectMaskedFrames:boolean

Web socket servers must set this to true processed incoming masked payload. Client implementations must set this to false.

allowExtensions:boolean

Flag to allow reserved extension bits to be used or not

maxFramePayloadLength:int

Maximum length of a frame's payload. Setting this to an appropriate value for you application helps check for denial of services attacks.

WebSocket13FrameDecoderback to summary
public WebSocket13FrameDecoder(boolean expectMaskedFrames, boolean allowExtensions, int maxFramePayloadLength, boolean allowMaskMismatch)

Constructor

Parameters
expectMaskedFrames:boolean

Web socket servers must set this to true processed incoming masked payload. Client implementations must set this to false.

allowExtensions:boolean

Flag to allow reserved extension bits to be used or not

maxFramePayloadLength:int

Maximum length of a frame's payload. Setting this to an appropriate value for you application helps check for denial of services attacks.

allowMaskMismatch:boolean

When set to true, frames which are not masked properly according to the standard will still be accepted.

WebSocket13FrameDecoderback to summary
public WebSocket13FrameDecoder(WebSocketDecoderConfig decoderConfig)

Constructor

Parameters
decoderConfig:WebSocketDecoderConfig

Frames decoder configuration.

Method Detail

checkCloseFrameBodyback to summary
protected void checkCloseFrameBody(ChannelHandlerContext ctx, Buffer buffer)
decodeback to summary
protected void decode(ChannelHandlerContext ctx, Buffer in) throws Exception

Implements abstract io.netty5.handler.codec.ByteToMessageDecoder.decode.

Doc from io.netty5.handler.codec.ByteToMessageDecoder.decode.

Decode the from one Buffer to another. This method will be called till either the input Buffer has nothing to read when return from this method or till nothing was read from the input Buffer.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this ByteToMessageDecoder belongs to

in:Buffer

the Buffer from which to read data

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs
protocolViolationback to summary
private void protocolViolation(ChannelHandlerContext ctx, Buffer in, String reason)
protocolViolationback to summary
private void protocolViolation(ChannelHandlerContext ctx, Buffer in, WebSocketCloseStatus status, String reason)
protocolViolationback to summary
private void protocolViolation(ChannelHandlerContext ctx, Buffer in, CorruptedWebSocketFrameException ex)
toFrameLengthback to summary
private static int toFrameLength(long length)
unmaskback to summary
private void unmask(Buffer frame)
io.netty5.handler.codec.http.websocketx back to summary

pack-priv final Enum WebSocket13FrameDecoder.State

extends Enum<WebSocket13FrameDecoder.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final WebSocket13FrameDecoder.State
public static final WebSocket13FrameDecoder.State
public static final WebSocket13FrameDecoder.State
public static final WebSocket13FrameDecoder.State
public static final WebSocket13FrameDecoder.State
public static final WebSocket13FrameDecoder.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static WebSocket13FrameDecoder.State
public static WebSocket13FrameDecoder.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CORRUPTback to summary
public static final WebSocket13FrameDecoder.State CORRUPT
MASKING_KEYback to summary
public static final WebSocket13FrameDecoder.State MASKING_KEY
PAYLOADback to summary
public static final WebSocket13FrameDecoder.State PAYLOAD
READING_FIRSTback to summary
public static final WebSocket13FrameDecoder.State READING_FIRST
READING_SECONDback to summary
public static final WebSocket13FrameDecoder.State READING_SECOND
READING_SIZEback to summary
public static final WebSocket13FrameDecoder.State READING_SIZE

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static WebSocket13FrameDecoder.State valueOf(String name)
valuesback to summary
public static WebSocket13FrameDecoder.State[] values()