org.glassfish.tyrus
Class AnnotatedEndpoint

java.lang.Object
  extended by javax.websocket.Endpoint
      extended by org.glassfish.tyrus.AnnotatedEndpoint

public class AnnotatedEndpoint
extends Endpoint

AnnotatedEndpoint of a class annotated using the WebSocketEndpoint annotations

Author:
Martin Matula (martin.matula at oracle.com)

Method Summary
static AnnotatedEndpoint fromClass(Class<?> annotatedClass)
           
static AnnotatedEndpoint fromInstance(Object annotatedInstance)
           
 EndpointConfiguration getEndpointConfiguration()
          Developers must provide an EndpointConfiguration so that the container it is deployed in can configure it.
 void onClose(CloseReason closeReason)
          This method is called when the session with the client is terminated.
 void onError(Throwable thr)
          Developers may implement this method when the web socket session creates some kind of error that is not modeled in the web socket protocol.
 void onOpen(Session session)
          Developers must implement this method to be notified when a new conversation has just begun.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromClass

public static AnnotatedEndpoint fromClass(Class<?> annotatedClass)

fromInstance

public static AnnotatedEndpoint fromInstance(Object annotatedInstance)

onClose

public void onClose(CloseReason closeReason)
Description copied from class: Endpoint
This method is called when the session with the client is terminated.

Overrides:
onClose in class Endpoint
Parameters:
closeReason - the reason the session was closed.

onError

public void onError(Throwable thr)
Description copied from class: Endpoint
Developers may implement this method when the web socket session creates some kind of error that is not modeled in the web socket protocol. This may for example be a notification that an incoming message is too big to handle, or that the incoming message could not be encoded.

There are a number of categories of exception that this method is (currently) defined to handle:-
- connection problems, for example, a socket failure that occurs before the web socket connection can be formally closed.
- errors thrown by developer create message handlers calls.
- conversion errors encoding incoming messages before any message handler has been called.
TBD We may come up with less of a 'catch-all' mechanism for handling exceptions, especially given the varying nature of these categories of exception.

Overrides:
onError in class Endpoint
Parameters:
thr - the throwable representing the problem.

getEndpointConfiguration

public EndpointConfiguration getEndpointConfiguration()
Description copied from class: Endpoint
Developers must provide an EndpointConfiguration so that the container it is deployed in can configure it.

Specified by:
getEndpointConfiguration in class Endpoint
Returns:
an EndpointConfiguration used to configure the Endpoint

onOpen

public void onOpen(Session session)
Description copied from class: Endpoint
Developers must implement this method to be notified when a new conversation has just begun.

Specified by:
onOpen in class Endpoint
Parameters:
session - the session that has just been activated.


Copyright © 2012. All Rights Reserved.