Class WsFrameServer
java.lang.Object
org.apache.tomcat.websocket.WsFrameBase
org.apache.tomcat.websocket.server.WsFrameServer
WebSocket frame handler for server connections.
-
Nested Class Summary
Nested classes/interfaces inherited from class WsFrameBase
WsFrameBase.ReadState -
Field Summary
Fields inherited from class WsFrameBase
inputBuffer, wsSession -
Constructor Summary
ConstructorsConstructorDescriptionWsFrameServer(SocketWrapperBase<?> socketWrapper, UpgradeInfo upgradeInfo, WsSession wsSession, Transformation transformation, ClassLoader applicationClassLoader) Constructs a new WsFrameServer. -
Method Summary
Modifier and TypeMethodDescriptionprotected LoggetLog()Returns the log instance for this frame.protected TransformationReturns the transformation applied to this frame.protected booleanisMasked()Returns whether frames from this peer must be masked.protected booleanisOpen()Returns whether the connection is open.protected voidThis method will be invoked when the read operation is resumed.protected voidsendMessageBinary(ByteBuffer msg, boolean last) Sends a binary message to the remote endpoint.protected voidsendMessageText(boolean last) Sends a text message to the remote endpoint.protected voidupdateStats(long payloadLength) Hook for updating server side statistics.Methods inherited from class WsFrameBase
byteArrayToLong, changeReadState, changeReadState, getReadState, isSuspended, processInputBuffer, resume, suspend
-
Constructor Details
-
WsFrameServer
public WsFrameServer(SocketWrapperBase<?> socketWrapper, UpgradeInfo upgradeInfo, WsSession wsSession, Transformation transformation, ClassLoader applicationClassLoader) Constructs a new WsFrameServer.- Parameters:
socketWrapper- The socket wrapperupgradeInfo- The upgrade informationwsSession- The WebSocket sessiontransformation- The transformation to applyapplicationClassLoader- The application class loader
-
-
Method Details
-
updateStats
protected void updateStats(long payloadLength) Description copied from class:WsFrameBaseHook for updating server side statistics. Called on every frame received.- Overrides:
updateStatsin classWsFrameBase- Parameters:
payloadLength- Size of message payload
-
isMasked
protected boolean isMasked()Description copied from class:WsFrameBaseReturns whether frames from this peer must be masked.- Specified by:
isMaskedin classWsFrameBase- Returns:
trueif frames must be masked
-
getTransformation
Description copied from class:WsFrameBaseReturns the transformation applied to this frame.- Overrides:
getTransformationin classWsFrameBase- Returns:
- the transformation
-
isOpen
protected boolean isOpen()Description copied from class:WsFrameBaseReturns whether the connection is open.- Overrides:
isOpenin classWsFrameBase- Returns:
trueif open
-
getLog
Description copied from class:WsFrameBaseReturns the log instance for this frame.- Specified by:
getLogin classWsFrameBase- Returns:
- the log instance
-
sendMessageText
Description copied from class:WsFrameBaseSends a text message to the remote endpoint.- Overrides:
sendMessageTextin classWsFrameBase- Parameters:
last- Whether this is the last fragment of the message- Throws:
WsIOException- If a WebSocket I/O error occurs
-
sendMessageBinary
Description copied from class:WsFrameBaseSends a binary message to the remote endpoint.- Overrides:
sendMessageBinaryin classWsFrameBase- Parameters:
msg- The message datalast- Whether this is the last fragment of the message- Throws:
WsIOException- If a WebSocket I/O error occurs
-
resumeProcessing
protected void resumeProcessing()Description copied from class:WsFrameBaseThis method will be invoked when the read operation is resumed. Since suspend of the read operation can be invoked at any time, when implementing this method one should consider that there might still be data remaining into the internal buffers that needs to be processed before reading again from the socket.- Specified by:
resumeProcessingin classWsFrameBase
-