org.glassfish.tyrus.platform
Class WebSocketEndpointImpl

java.lang.Object
  extended by org.glassfish.tyrus.platform.WebSocketEndpointImpl
All Implemented Interfaces:
SPIEndpoint
Direct Known Subclasses:
WebSocketEndpointAdapter

public class WebSocketEndpointImpl
extends Object
implements SPIEndpoint

Handles the registered application class. There is one WebSocketEndpoint for each application class, which handles all the methods (even for various dynamic paths).

Author:
dannycoward, Stepan Kopriva (stepan.kopriva at oracle.com)

Constructor Summary
WebSocketEndpointImpl(ServerContainerImpl containerContext, String path, Model model, Boolean server)
          Creates new endpoint - see above.
WebSocketEndpointImpl(ServerContainer containerContext, String path, Model model)
          Creates new endpoint.
 
Method Summary
 boolean checkHandshake(SPIHandshakeRequest hr)
           
protected  boolean doesPathMatch(String remoteUri, String dynamicPath)
          Checks whether the provided dynamicPath matches with this endpoint, i.e.
 ServerContainer getContainerContext()
           
protected  RemoteEndpointWrapper getPeer(SPIRemoteEndpoint gs)
           
 List<String> getSupportedProtocols(List<String> subProtocol)
           
 void handleGeneratedBeanException(RemoteEndpoint peer, Exception e)
           
 void onClose(SPIRemoteEndpoint gs)
           
 void onConnect(SPIRemoteEndpoint gs)
           
 void onGeneratedBeanClose(RemoteEndpointWrapper peer)
           
 void onGeneratedBeanConnect(RemoteEndpointWrapper peer)
           
 void onMessage(SPIRemoteEndpoint gs, byte[] messageBytes)
           
 void onMessage(SPIRemoteEndpoint gs, String messageString)
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebSocketEndpointImpl

public WebSocketEndpointImpl(ServerContainer containerContext,
                             String path,
                             Model model)
Creates new endpoint.

Parameters:
containerContext - container context.
path - address of this endpoint as annotated by WebSocketEndpoint annotation.
model - model of the application class.

WebSocketEndpointImpl

public WebSocketEndpointImpl(ServerContainerImpl containerContext,
                             String path,
                             Model model,
                             Boolean server)
Creates new endpoint - see above.

Parameters:
containerContext - container context.
path - address of this endpoint as annotated by WebSocketEndpoint annotation.
model - model of the application class.
server - server / client endpoint.
Method Detail

doesPathMatch

protected boolean doesPathMatch(String remoteUri,
                                String dynamicPath)
Checks whether the provided dynamicPath matches with this endpoint, i.e. if there is a method that can process the request.

Parameters:
remoteUri - path to be checked.
dynamicPath - taken from the WebSocketMessage method annotation.
Returns:
true if the paths match, false otherwise.

checkHandshake

public boolean checkHandshake(SPIHandshakeRequest hr)
Specified by:
checkHandshake in interface SPIEndpoint

getSupportedProtocols

public List<String> getSupportedProtocols(List<String> subProtocol)
Specified by:
getSupportedProtocols in interface SPIEndpoint

remove

public void remove()
Specified by:
remove in interface SPIEndpoint

onConnect

public void onConnect(SPIRemoteEndpoint gs)
Specified by:
onConnect in interface SPIEndpoint

onMessage

public void onMessage(SPIRemoteEndpoint gs,
                      byte[] messageBytes)
Specified by:
onMessage in interface SPIEndpoint

onMessage

public void onMessage(SPIRemoteEndpoint gs,
                      String messageString)
Specified by:
onMessage in interface SPIEndpoint

onClose

public void onClose(SPIRemoteEndpoint gs)
Specified by:
onClose in interface SPIEndpoint

handleGeneratedBeanException

public void handleGeneratedBeanException(RemoteEndpoint peer,
                                         Exception e)

onGeneratedBeanConnect

public void onGeneratedBeanConnect(RemoteEndpointWrapper peer)

onGeneratedBeanClose

public void onGeneratedBeanClose(RemoteEndpointWrapper peer)

getPeer

protected final RemoteEndpointWrapper getPeer(SPIRemoteEndpoint gs)

getContainerContext

public ServerContainer getContainerContext()


Copyright © 2012. All Rights Reserved.