Top Description Fields Methods
io.undertow.websockets.extensions

public Interface ExtensionFunction

Known Direct Implementers
io.undertow.websockets.extensions.NoopExtensionFunction, io.undertow.websockets.extensions.PerMessageDeflateFunction, io.undertow.websockets.extensions.CompositeExtensionFunction
Imports
io.undertow.connector.PooledByteBuffer, io.undertow.websockets.core.StreamSinkFrameChannel, .StreamSourceFrameChannel, java.io.IOException

Base interface for WebSocket Extensions implementation.

It interacts at the connection phase. It is responsible to apply extension's logic before to write and after to read to/from a WebSocket Endpoint.

Several extensions can be present in a WebSocket Endpoint being executed in a chain pattern.

Extension state is stored per WebSocket connection.

Author
Lucas Ponce

Field Summary

Modifier and TypeField and Description
public static final int
RSV1

Bitmask for RSV1 bit used in extensions.

public static final int
RSV2

Bitmask for RSV2 bit used in extensions.

public static final int
RSV3

Bitmask for RSV3 bit used in extensions.

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Dispose this function.

public boolean

Returns:

true if current extension defines specific Opcode false is current extension does not define specific Opcode
hasExtensionOpCode
()

Validate if current extension defines a new WebSocket Opcode.

public PooledByteBuffer

Returns:

transformed buffer (may be the same one, just with modified contents)
transformForRead
(PooledByteBuffer
Buffer to transform
pooledBuffer
,
StreamSourceFrameChannel
working channel
channel
,
boolean
If this frame is the last fragment of a message. Note that this may not be received for every message, if the message ends with an empty frame
lastFragmentOfMessage
)

Transform the supplied buffer per this extension.

public PooledByteBuffer

Returns:

transformed buffer (may be the same one, just with modified contents)
transformForWrite
(PooledByteBuffer
Buffer to transform
pooledBuffer
,
StreamSinkFrameChannel
working channel
channel
,
boolean lastFrame)

Transform the supplied buffer per this extension.

public int

Returns:

rsv status
writeRsv
(int
current RSV bits status
rsv
)

Add RSV bits (RSV1, RSV2, RSV3) to the current rsv status.

Field Detail

RSV1back to summary
public static final int RSV1

Bitmask for RSV1 bit used in extensions.

RSV2back to summary
public static final int RSV2

Bitmask for RSV2 bit used in extensions.

RSV3back to summary
public static final int RSV3

Bitmask for RSV3 bit used in extensions.

Method Detail

disposeback to summary
public void dispose()

Dispose this function. Called upon connection closure

hasExtensionOpCodeback to summary
public boolean hasExtensionOpCode()

Validate if current extension defines a new WebSocket Opcode.

Returns:boolean

true if current extension defines specific Opcode false is current extension does not define specific Opcode

See Also
WebSocket Base Framing Protocol Reference
transformForReadback to summary
public PooledByteBuffer transformForRead(PooledByteBuffer pooledBuffer, StreamSourceFrameChannel channel, boolean lastFragmentOfMessage) throws IOException

Transform the supplied buffer per this extension. The buffer can be modified in place, or a new pooled buffer can be returned (in which case be sure to free the original buffer

Parameters
pooledBuffer:PooledByteBuffer

Buffer to transform

channel:StreamSourceFrameChannel

working channel

lastFragmentOfMessage:boolean

If this frame is the last fragment of a message. Note that this may not be received for every message, if the message ends with an empty frame

Returns:PooledByteBuffer

transformed buffer (may be the same one, just with modified contents)

transformForWriteback to summary
public PooledByteBuffer transformForWrite(PooledByteBuffer pooledBuffer, StreamSinkFrameChannel channel, boolean lastFrame) throws IOException

Transform the supplied buffer per this extension. The buffer can be modified in place, or a new pooled buffer can be returned (in which case be sure to free the original buffer

Parameters
pooledBuffer:PooledByteBuffer

Buffer to transform

channel:StreamSinkFrameChannel

working channel

Returns:PooledByteBuffer

transformed buffer (may be the same one, just with modified contents)

writeRsvback to summary
public int writeRsv(int rsv)

Add RSV bits (RSV1, RSV2, RSV3) to the current rsv status.

Parameters
rsv:int

current RSV bits status

Returns:int

rsv status