Package org.apache.tomcat.websocket
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 SummaryNested ClassesModifier and TypeClassDescriptionprotected static enumWAITING - 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 SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected static longbyteArrayToLong(byte[] b, int start, int len) protected voidchangeReadState(WsFrameBase.ReadState newState) protected booleanchangeReadState(WsFrameBase.ReadState oldState, WsFrameBase.ReadState newState) protected abstract LoggetLog()protected WsFrameBase.ReadStateprotected Transformationprotected abstract booleanisMasked()protected booleanisOpen()protected booleanprotected voidvoidresume()protected abstract voidThis method will be invoked when the read operation is resumed.protected voidsendMessageBinary(ByteBuffer msg, boolean last) protected voidsendMessageText(boolean last) voidsuspend()protected voidupdateStats(long payloadLength) Hook for updating server side statistics.
- 
Field Details- 
wsSession
- 
inputBuffer
 
- 
- 
Constructor Details- 
WsFrameBase
 
- 
- 
Method Details- 
processInputBuffer- Throws:
- IOException
 
- 
isMaskedprotected abstract boolean isMasked()
- 
getLog
- 
updateStatsprotected 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
 
- 
isOpenprotected boolean isOpen()
- 
getTransformation
- 
suspendpublic void suspend()
- 
resumepublic void resume()
- 
isSuspendedprotected boolean isSuspended()
- 
getReadState
- 
changeReadState
- 
changeReadState
- 
resumeProcessingprotected 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.
 
-