Top Description Methods
org.apache.tomcat.websocket

public Interface Transformation

Known Direct Implementers
org.apache.tomcat.websocket.WsFrameBase.TerminalTransformation, org.apache.tomcat.websocket.PerMessageDeflate
Imports
java.io.IOException, java.nio.ByteBuffer, java.util.List, jakarta.websocket.Extension

The internal representation of the transformation that a WebSocket extension performs on a message.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Clean-up any resources that were used by the transformation.

public Extension

Returns:

The extension information that describes the parameters that have been agreed for this transformation
getExtensionResponse
()

Obtain the extension that describes the information to be returned to the client.

public TransformationResult

Returns:

The result of trying to read more data from the transform
getMoreData
(byte
The opcode for the frame currently being processed
opCode
,
boolean
Is this the final frame in this WebSocket message?
fin
,
int
The reserved bits for the frame currently being processed
rsv
,
ByteBuffer
The buffer in which the data is to be written
dest
)

Obtain more input data.

public List<MessagePart>

Returns:

The list of messages after this any any subsequent transformations have been applied. The size of the returned list may be bigger or smaller than the size of the input list
sendMessagePart
(List<MessagePart>
The list of messages to be transformed
messageParts
)

Takes the provided list of messages, transforms them, passes the transformed list on to the next transformation (if any) and then returns the resulting list of message parts after all of the transformations have been applied.

public void
setNext(Transformation
The next transformation
t
)

Sets the next transformation in the pipeline.

public boolean

Returns:

true if the RSV is valid otherwise false
validateRsv
(int
The RSV bits received as an int in the range zero to seven with RSV1 as the MSB and RSV3 as the LSB
rsv
,
byte
The opCode received
opCode
)

Validates the RSV and opcode combination (assumed to have been extracted from a WebSocket Frame) for this extension.

public boolean

Returns:

true if the combination of RSV bits used by the transformations in the pipeline do not conflict otherwise false
validateRsvBits
(int
The RSV bits marked as in use so far as an int in the range zero to seven with RSV1 as the MSB and RSV3 as the LSB
i
)

Validate that the RSV bit(s) required by this transformation are not being used by another extension.

Method Detail

closeback to summary
public void close()

Clean-up any resources that were used by the transformation.

getExtensionResponseback to summary
public Extension getExtensionResponse()

Obtain the extension that describes the information to be returned to the client.

Returns:Extension

The extension information that describes the parameters that have been agreed for this transformation

getMoreDataback to summary
public TransformationResult getMoreData(byte opCode, boolean fin, int rsv, ByteBuffer dest) throws IOException

Obtain more input data.

Parameters
opCode:byte

The opcode for the frame currently being processed

fin:boolean

Is this the final frame in this WebSocket message?

rsv:int

The reserved bits for the frame currently being processed

dest:ByteBuffer

The buffer in which the data is to be written

Returns:TransformationResult

The result of trying to read more data from the transform

Exceptions
IOException:
If an I/O error occurs while reading data from the transform
sendMessagePartback to summary
public List<MessagePart> sendMessagePart(List<MessagePart> messageParts) throws IOException

Takes the provided list of messages, transforms them, passes the transformed list on to the next transformation (if any) and then returns the resulting list of message parts after all of the transformations have been applied.

Parameters
messageParts:List<MessagePart>

The list of messages to be transformed

Returns:List<MessagePart>

The list of messages after this any any subsequent transformations have been applied. The size of the returned list may be bigger or smaller than the size of the input list

Exceptions
IOException:
If an error occurs during the transformation of the message parts
setNextback to summary
public void setNext(Transformation t)

Sets the next transformation in the pipeline.

Parameters
t:Transformation

The next transformation

validateRsvback to summary
public boolean validateRsv(int rsv, byte opCode)

Validates the RSV and opcode combination (assumed to have been extracted from a WebSocket Frame) for this extension. The implementation is expected to unset any RSV bits it has validated before passing the remaining RSV bits to the next transformation in the pipeline.

Parameters
rsv:int

The RSV bits received as an int in the range zero to seven with RSV1 as the MSB and RSV3 as the LSB

opCode:byte

The opCode received

Returns:boolean

true if the RSV is valid otherwise false

validateRsvBitsback to summary
public boolean validateRsvBits(int i)

Validate that the RSV bit(s) required by this transformation are not being used by another extension. The implementation is expected to set any bits it requires before passing the set of in-use bits to the next transformation.

Parameters
i:int

The RSV bits marked as in use so far as an int in the range zero to seven with RSV1 as the MSB and RSV3 as the LSB

Returns:boolean

true if the combination of RSV bits used by the transformations in the pipeline do not conflict otherwise false