Package org.glassfish.tyrus.core
Class AnnotatedEndpoint
- java.lang.Object
-
- javax.websocket.Endpoint
-
- org.glassfish.tyrus.core.AnnotatedEndpoint
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AnnotatedEndpoint
fromClass(java.lang.Class<?> annotatedClass, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, EndpointEventListener endpointEventListener)
CreateAnnotatedEndpoint
from class.static AnnotatedEndpoint
fromClass(java.lang.Class<?> annotatedClass, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, EndpointEventListener endpointEventListener, java.util.Set<Extension> extensions)
CreateAnnotatedEndpoint
from class.static AnnotatedEndpoint
fromInstance(java.lang.Object annotatedInstance, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector)
CreateAnnotatedEndpoint
from instance.static AnnotatedEndpoint
fromInstance(java.lang.Object annotatedInstance, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, java.util.Set<Extension> extensions)
CreateAnnotatedEndpoint
from instance.EndpointConfig
getEndpointConfig()
void
onClose(Session session, CloseReason closeReason)
This method is called immediately prior to the session with the remote peer being closed.void
onError(Session session, java.lang.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, EndpointConfig configuration)
Developers must implement this method to be notified when a new conversation has just begun.
-
-
-
Method Detail
-
fromClass
public static AnnotatedEndpoint fromClass(java.lang.Class<?> annotatedClass, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, EndpointEventListener endpointEventListener)
CreateAnnotatedEndpoint
from class.- Parameters:
annotatedClass
- annotated class.componentProvider
- used for instantiating.isServerEndpoint
-true
iff annotated endpoint is deployed on server side.incomingBufferSize
- size limit of the incoming buffer.collector
- error collector.endpointEventListener
- listener of monitored endpoint events.- Returns:
- new instance.
-
fromClass
public static AnnotatedEndpoint fromClass(java.lang.Class<?> annotatedClass, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, EndpointEventListener endpointEventListener, java.util.Set<Extension> extensions)
CreateAnnotatedEndpoint
from class.- Parameters:
annotatedClass
- annotated class.componentProvider
- used for instantiating.isServerEndpoint
-true
iff annotated endpoint is deployed on server side.incomingBufferSize
- size limit of the incoming buffer.collector
- error collector.endpointEventListener
- listener of monitored endpoint events.extensions
- installed extentions.- Returns:
- new instance.
-
fromInstance
public static AnnotatedEndpoint fromInstance(java.lang.Object annotatedInstance, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector)
CreateAnnotatedEndpoint
from instance.- Parameters:
annotatedInstance
- annotated instance.componentProvider
- used for instantiating.isServerEndpoint
-true
iff annotated endpoint is deployed on server side.incomingBufferSize
- size limit of the incoming buffercollector
- error collector.- Returns:
- new instance.
-
fromInstance
public static AnnotatedEndpoint fromInstance(java.lang.Object annotatedInstance, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, java.util.Set<Extension> extensions)
CreateAnnotatedEndpoint
from instance.- Parameters:
annotatedInstance
- annotated instance.componentProvider
- used for instantiating.isServerEndpoint
-true
iff annotated endpoint is deployed on server side.incomingBufferSize
- size limit of the incoming buffercollector
- error collector.extensions
- installed extentions.- Returns:
- new instance.
-
onClose
public void onClose(Session session, CloseReason closeReason)
Description copied from class:Endpoint
This method is called immediately prior to the session with the remote peer being closed. It is called whether the session is being closed because the remote peer initiated a close and sent a close frame, or whether the local websocket container or this endpoint requests to close the session. The developer may take this last opportunity to retrieve session attributes such as the ID, or any application data it holds before it becomes unavailable after the completion of the method. Developers should not attempt to modify the session from within this method, or send new messages from this call as the underlying connection will not be able to send them at this stage.
-
onError
public void onError(Session session, java.lang.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. These are modeled as
SessionException
s - runtime errors thrown by developer created message handlers calls.
- conversion errors encoding incoming messages before any message handler has been called. These are modeled as
DecodeException
s
- connection problems, for example, a socket failure that occurs before the web socket connection can be
formally closed. These are modeled as
-
getEndpointConfig
public EndpointConfig getEndpointConfig()
-
onOpen
public void onOpen(Session session, EndpointConfig configuration)
Description copied from class:Endpoint
Developers must implement this method to be notified when a new conversation has just begun.
-
-