org.glassfish.tyrus.platform
Class RemoteEndpointWrapper<T>

java.lang.Object
  extended by org.glassfish.tyrus.platform.RemoteEndpointWrapper<T>
All Implemented Interfaces:
javax.net.websocket.RemoteEndpoint<T>

public final class RemoteEndpointWrapper<T>
extends java.lang.Object
implements javax.net.websocket.RemoteEndpoint<T>

Wrapps the RemoteEndpoint and represents the other side of the websocket connection.

Author:
Danny Coward, Martin Matula (martin.matula at oracle.com), Stepan Kopriva (stepan.kopriva at oracle.com)

Method Summary
 void close(javax.net.websocket.CloseReason cr)
           
 java.lang.String getAddress()
          URI to which the remote originally connected.
static RemoteEndpointWrapper getRemoteWrapper(SPIRemoteEndpoint socket, WebSocketEndpointImpl application, boolean serverEndpoint)
          Get the RemoteEndpoint wrapper.
 java.io.OutputStream getSendStream()
           
 java.io.Writer getSendWriter()
           
 javax.net.websocket.Session getSession()
           
 boolean isConnected()
          The endpoint is connected.
 void sendBytes(byte[] data)
           
 java.util.concurrent.Future<javax.net.websocket.SendResult> sendBytes(byte[] data, javax.net.websocket.SendHandler completion)
           
 void sendObject(T o)
           
 java.util.concurrent.Future<javax.net.websocket.SendResult> sendObject(T o, javax.net.websocket.SendHandler handler)
           
 void sendPartialBytes(byte[] partialByte, boolean isLast)
           
 void sendPartialString(java.lang.String fragment, boolean isLast)
           
 void sendPing(byte[] applicationData)
           
 void sendPong(byte[] applicationData)
           
 void sendString(java.lang.String data)
           
 java.util.concurrent.Future<javax.net.websocket.SendResult> sendString(java.lang.String text, javax.net.websocket.SendHandler completion)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getRemoteWrapper

public static RemoteEndpointWrapper getRemoteWrapper(SPIRemoteEndpoint socket,
                                                     WebSocketEndpointImpl application,
                                                     boolean serverEndpoint)
Get the RemoteEndpoint wrapper.

Parameters:
socket - socket corresponding to the required wrapper
application - web socket endpoint for which the wrapper represents the other side of the connection
serverEndpoint - server / client endpoint
Returns:
wrapper corresponding to socket

getAddress

public java.lang.String getAddress()
URI to which the remote originally connected.

Returns:
URI

isConnected

public boolean isConnected()
The endpoint is connected.

Returns:
true iff the endpoint is connected, false otherwise.

sendString

public void sendString(java.lang.String data)
                throws java.io.IOException
Specified by:
sendString in interface javax.net.websocket.RemoteEndpoint<T>
Throws:
java.io.IOException

sendBytes

public void sendBytes(byte[] data)
               throws java.io.IOException
Specified by:
sendBytes in interface javax.net.websocket.RemoteEndpoint<T>
Throws:
java.io.IOException

sendPartialString

public void sendPartialString(java.lang.String fragment,
                              boolean isLast)
                       throws java.io.IOException
Specified by:
sendPartialString in interface javax.net.websocket.RemoteEndpoint<T>
Throws:
java.io.IOException

sendPartialBytes

public void sendPartialBytes(byte[] partialByte,
                             boolean isLast)
                      throws java.io.IOException
Specified by:
sendPartialBytes in interface javax.net.websocket.RemoteEndpoint<T>
Throws:
java.io.IOException

getSendStream

public java.io.OutputStream getSendStream()
                                   throws java.io.IOException
Specified by:
getSendStream in interface javax.net.websocket.RemoteEndpoint<T>
Throws:
java.io.IOException

getSendWriter

public java.io.Writer getSendWriter()
                             throws java.io.IOException
Specified by:
getSendWriter in interface javax.net.websocket.RemoteEndpoint<T>
Throws:
java.io.IOException

sendObject

public void sendObject(T o)
                throws java.io.IOException,
                       javax.net.websocket.EncodeException
Specified by:
sendObject in interface javax.net.websocket.RemoteEndpoint<T>
Throws:
java.io.IOException
javax.net.websocket.EncodeException

sendString

public java.util.concurrent.Future<javax.net.websocket.SendResult> sendString(java.lang.String text,
                                                                              javax.net.websocket.SendHandler completion)
Specified by:
sendString in interface javax.net.websocket.RemoteEndpoint<T>

sendBytes

public java.util.concurrent.Future<javax.net.websocket.SendResult> sendBytes(byte[] data,
                                                                             javax.net.websocket.SendHandler completion)
Specified by:
sendBytes in interface javax.net.websocket.RemoteEndpoint<T>

sendObject

public java.util.concurrent.Future<javax.net.websocket.SendResult> sendObject(T o,
                                                                              javax.net.websocket.SendHandler handler)
Specified by:
sendObject in interface javax.net.websocket.RemoteEndpoint<T>

sendPing

public void sendPing(byte[] applicationData)
Specified by:
sendPing in interface javax.net.websocket.RemoteEndpoint<T>

sendPong

public void sendPong(byte[] applicationData)
Specified by:
sendPong in interface javax.net.websocket.RemoteEndpoint<T>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

close

public void close(javax.net.websocket.CloseReason cr)
           throws java.io.IOException
Throws:
java.io.IOException

getSession

public javax.net.websocket.Session getSession()


Copyright © 2012. All Rights Reserved.