Package org.apache.tomcat.websocket
Class WsFrameBase
- java.lang.Object
- 
- org.apache.tomcat.websocket.WsFrameBase
 
- 
- Direct Known Subclasses:
- WsFrameClient,- WsFrameServer
 
 public abstract class WsFrameBase extends java.lang.ObjectTakes 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 Classes Modifier and Type Class Description protected static classWsFrameBase.ReadStateWAITING - 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 Modifier and Type Field Description protected java.nio.ByteBufferinputBufferprotected WsSessionwsSession
 - 
Constructor SummaryConstructors Constructor Description WsFrameBase(WsSession wsSession, Transformation transformation)
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected 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.ReadStategetReadState()protected TransformationgetTransformation()protected abstract booleanisMasked()protected booleanisOpen()protected booleanisSuspended()protected voidprocessInputBuffer()voidresume()protected abstract voidresumeProcessing()This method will be invoked when the read operation is resumed.protected voidsendMessageBinary(java.nio.ByteBuffer msg, boolean last)protected voidsendMessageText(boolean last)voidsuspend()protected voidupdateStats(long payloadLength)Hook for updating server side statistics.
 
- 
- 
- 
Field Detail- 
wsSessionprotected final WsSession wsSession 
 - 
inputBufferprotected final java.nio.ByteBuffer inputBuffer 
 
- 
 - 
Constructor Detail- 
WsFrameBasepublic WsFrameBase(WsSession wsSession, Transformation transformation) 
 
- 
 - 
Method Detail- 
processInputBufferprotected void processInputBuffer() throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
isMaskedprotected abstract boolean isMasked() 
 - 
getLogprotected abstract Log getLog() 
 - 
updateStatsprotected void updateStats(long payloadLength) Hook for updating server side statistics. Called on every frame received.- Parameters:
- payloadLength- Size of message payload
 
 - 
sendMessageTextprotected void sendMessageText(boolean last) throws WsIOException- Throws:
- WsIOException
 
 - 
sendMessageBinaryprotected void sendMessageBinary(java.nio.ByteBuffer msg, boolean last) throws WsIOException- Throws:
- WsIOException
 
 - 
byteArrayToLongprotected static long byteArrayToLong(byte[] b, int start, int len) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
isOpenprotected boolean isOpen() 
 - 
getTransformationprotected Transformation getTransformation() 
 - 
suspendpublic void suspend() 
 - 
resumepublic void resume() 
 - 
isSuspendedprotected boolean isSuspended() 
 - 
getReadStateprotected WsFrameBase.ReadState getReadState() 
 - 
changeReadStateprotected void changeReadState(WsFrameBase.ReadState newState) 
 - 
changeReadStateprotected boolean changeReadState(WsFrameBase.ReadState oldState, WsFrameBase.ReadState newState) 
 - 
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.
 
- 
 
-