Package org.apache.tomcat.websocket
Class WsRemoteEndpointImplBase
- java.lang.Object
- 
- org.apache.tomcat.websocket.WsRemoteEndpointImplBase
 
- 
- All Implemented Interfaces:
- RemoteEndpoint
 - Direct Known Subclasses:
- WsRemoteEndpointImplClient,- WsRemoteEndpointImplServer
 
 public abstract class WsRemoteEndpointImplBase extends java.lang.Object implements RemoteEndpoint 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from interface javax.websocket.RemoteEndpointRemoteEndpoint.Async, RemoteEndpoint.Basic
 
- 
 - 
Field SummaryFields Modifier and Type Field Description protected static SendResultSENDRESULT_OKprotected static StringManagersm
 - 
Constructor SummaryConstructors Constructor Description WsRemoteEndpointImplBase()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()protected abstract voiddoClose()protected abstract voiddoWrite(SendHandler handler, long blockingWriteTimeoutExpiry, java.nio.ByteBuffer... data)voidflushBatch()Flush any currently batched messages to the remote endpoint.booleangetBatchingAllowed()Obtains the current batching status of the endpoint.java.io.OutputStreamgetSendStream()longgetSendTimeout()java.io.WritergetSendWriter()protected abstract booleanisMasked()voidsendBytes(java.nio.ByteBuffer data)voidsendBytesByCompletion(java.nio.ByteBuffer data, SendHandler handler)java.util.concurrent.Future<java.lang.Void>sendBytesByFuture(java.nio.ByteBuffer data)voidsendObject(java.lang.Object obj)voidsendObjectByCompletion(java.lang.Object obj, SendHandler completion)java.util.concurrent.Future<java.lang.Void>sendObjectByFuture(java.lang.Object obj)voidsendPartialBytes(java.nio.ByteBuffer partialByte, boolean last)voidsendPartialString(java.lang.String fragment, boolean isLast)voidsendPing(java.nio.ByteBuffer applicationData)Send a ping message blocking until the message has been sent.voidsendPong(java.nio.ByteBuffer applicationData)Send a pong message blocking until the message has been sent.voidsendString(java.lang.String text)voidsendStringByCompletion(java.lang.String text, SendHandler handler)java.util.concurrent.Future<java.lang.Void>sendStringByFuture(java.lang.String text)voidsetBatchingAllowed(boolean batchingAllowed)Enable or disable the batching of outgoing messages for this endpoint.protected voidsetEncoders(EndpointConfig endpointConfig)voidsetSendTimeout(long timeout)protected voidsetSession(WsSession wsSession)protected voidsetTransformation(Transformation transformation)protected voidupdateStats(long payloadLength)Hook for updating server side statistics.
 
- 
- 
- 
Field Detail- 
smprotected static final StringManager sm 
 - 
SENDRESULT_OKprotected static final SendResult SENDRESULT_OK 
 
- 
 - 
Method Detail- 
setTransformationprotected void setTransformation(Transformation transformation) 
 - 
getSendTimeoutpublic long getSendTimeout() 
 - 
setSendTimeoutpublic void setSendTimeout(long timeout) 
 - 
setBatchingAllowedpublic void setBatchingAllowed(boolean batchingAllowed) throws java.io.IOExceptionDescription copied from interface:javax.websocket.RemoteEndpointEnable or disable the batching of outgoing messages for this endpoint. If batching is disabled when it was previously enabled then this method will block until any currently batched messages have been written.- Specified by:
- setBatchingAllowedin interface- RemoteEndpoint
- Parameters:
- batchingAllowed- New setting
- Throws:
- java.io.IOException- If changing the value resulted in a call to- RemoteEndpoint.flushBatch()and that call threw an- IOException.
 
 - 
getBatchingAllowedpublic boolean getBatchingAllowed() Description copied from interface:javax.websocket.RemoteEndpointObtains the current batching status of the endpoint.- Specified by:
- getBatchingAllowedin interface- RemoteEndpoint
- Returns:
- trueif batching is enabled, otherwise- false.
 
 - 
flushBatchpublic void flushBatch() throws java.io.IOExceptionDescription copied from interface:javax.websocket.RemoteEndpointFlush any currently batched messages to the remote endpoint. This method will block until the flush completes.- Specified by:
- flushBatchin interface- RemoteEndpoint
- Throws:
- java.io.IOException- If an I/O error occurs while flushing
 
 - 
sendBytespublic void sendBytes(java.nio.ByteBuffer data) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
sendBytesByFuturepublic java.util.concurrent.Future<java.lang.Void> sendBytesByFuture(java.nio.ByteBuffer data) 
 - 
sendBytesByCompletionpublic void sendBytesByCompletion(java.nio.ByteBuffer data, SendHandler handler)
 - 
sendPartialBytespublic void sendPartialBytes(java.nio.ByteBuffer partialByte, boolean last) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
sendPingpublic void sendPing(java.nio.ByteBuffer applicationData) throws java.io.IOException, java.lang.IllegalArgumentExceptionDescription copied from interface:javax.websocket.RemoteEndpointSend a ping message blocking until the message has been sent. Note that if a message is in the process of being sent asynchronously, this method will block until that message and this ping has been sent.- Specified by:
- sendPingin interface- RemoteEndpoint
- Parameters:
- applicationData- The payload for the ping message
- Throws:
- java.io.IOException- If an I/O error occurs while sending the ping
- java.lang.IllegalArgumentException- if the applicationData is too large for a control message (max 125 bytes)
 
 - 
sendPongpublic void sendPong(java.nio.ByteBuffer applicationData) throws java.io.IOException, java.lang.IllegalArgumentExceptionDescription copied from interface:javax.websocket.RemoteEndpointSend a pong message blocking until the message has been sent. Note that if a message is in the process of being sent asynchronously, this method will block until that message and this pong has been sent.- Specified by:
- sendPongin interface- RemoteEndpoint
- Parameters:
- applicationData- The payload for the pong message
- Throws:
- java.io.IOException- If an I/O error occurs while sending the pong
- java.lang.IllegalArgumentException- if the applicationData is too large for a control message (max 125 bytes)
 
 - 
sendStringpublic void sendString(java.lang.String text) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
sendStringByFuturepublic java.util.concurrent.Future<java.lang.Void> sendStringByFuture(java.lang.String text) 
 - 
sendStringByCompletionpublic void sendStringByCompletion(java.lang.String text, SendHandler handler)
 - 
sendPartialStringpublic void sendPartialString(java.lang.String fragment, boolean isLast) throws java.io.IOException- Throws:
- java.io.IOException
 
 - 
getSendStreampublic java.io.OutputStream getSendStream() 
 - 
getSendWriterpublic java.io.Writer getSendWriter() 
 - 
updateStatsprotected void updateStats(long payloadLength) Hook for updating server side statistics. Called on every frame written (including when batching is enabled and the frames are buffered locally until the buffer is full or is flushed).- Parameters:
- payloadLength- Size of message payload
 
 - 
sendObjectpublic void sendObject(java.lang.Object obj) throws java.io.IOException, EncodeException- Throws:
- java.io.IOException
- EncodeException
 
 - 
sendObjectByFuturepublic java.util.concurrent.Future<java.lang.Void> sendObjectByFuture(java.lang.Object obj) 
 - 
sendObjectByCompletionpublic void sendObjectByCompletion(java.lang.Object obj, SendHandler completion)
 - 
setSessionprotected void setSession(WsSession wsSession) 
 - 
setEncodersprotected void setEncoders(EndpointConfig endpointConfig) throws DeploymentException - Throws:
- DeploymentException
 
 - 
closepublic final void close() 
 - 
doWriteprotected abstract void doWrite(SendHandler handler, long blockingWriteTimeoutExpiry, java.nio.ByteBuffer... data) 
 - 
isMaskedprotected abstract boolean isMasked() 
 - 
doCloseprotected abstract void doClose() 
 
- 
 
-