Class WsFrameBase
java.lang.Object
org.apache.tomcat.websocket.WsFrameBase
- Direct Known Subclasses:
WsFrameClient
,WsFrameServer
Takes the ServletInputStream, processes the WebSocket frames it contains and extracts the messages. WebSocket Pings
received will be responded to automatically without any action required by the application.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static enum
WAITING - not suspended Server case: waiting for a notification that data is ready to be read from the socket, the socket is registered to the poller Client case: data has been read from the socket and is waiting for data to be processed PROCESSING - not suspended Server case: reading from the socket and processing the data Client case: processing the data if such has already been read and more data will be read from the socket SUSPENDING_WAIT - suspended, a call to suspend() was made while in WAITING state. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static long
byteArrayToLong
(byte[] b, int start, int len) protected void
changeReadState
(WsFrameBase.ReadState newState) protected boolean
changeReadState
(WsFrameBase.ReadState oldState, WsFrameBase.ReadState newState) protected abstract Log
getLog()
protected WsFrameBase.ReadState
protected Transformation
protected abstract boolean
isMasked()
protected boolean
isOpen()
protected boolean
protected void
void
resume()
protected abstract void
This method will be invoked when the read operation is resumed.protected void
sendMessageBinary
(ByteBuffer msg, boolean last) protected void
sendMessageText
(boolean last) void
suspend()
protected void
updateStats
(long payloadLength) Hook for updating server side statistics.
-
Field Details
-
wsSession
-
inputBuffer
-
-
Constructor Details
-
WsFrameBase
-
-
Method Details
-
processInputBuffer
- Throws:
IOException
-
isMasked
protected abstract boolean isMasked() -
getLog
-
updateStats
protected void updateStats(long payloadLength) Hook for updating server side statistics. Called on every frame received.- Parameters:
payloadLength
- Size of message payload
-
sendMessageText
- Throws:
WsIOException
-
sendMessageBinary
- Throws:
WsIOException
-
byteArrayToLong
- Throws:
IOException
-
isOpen
protected boolean isOpen() -
getTransformation
-
suspend
public void suspend() -
resume
public void resume() -
isSuspended
protected boolean isSuspended() -
getReadState
-
changeReadState
-
changeReadState
-
resumeProcessing
protected abstract void resumeProcessing()This method will be invoked when the read operation is resumed. As the 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.
-