Package org.glassfish.tyrus.core
Class AnnotatedEndpoint
- java.lang.Object
-
- jakarta.websocket.Endpoint
-
- org.glassfish.tyrus.core.AnnotatedEndpoint
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AnnotatedEndpointfromClass(java.lang.Class<?> annotatedClass, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, EndpointEventListener endpointEventListener)CreateAnnotatedEndpointfrom class.static AnnotatedEndpointfromClass(java.lang.Class<?> annotatedClass, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, EndpointEventListener endpointEventListener, java.util.Set<Extension> extensions)CreateAnnotatedEndpointfrom class.static AnnotatedEndpointfromInstance(java.lang.Object annotatedInstance, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector)CreateAnnotatedEndpointfrom instance.static AnnotatedEndpointfromInstance(java.lang.Object annotatedInstance, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, java.util.Set<Extension> extensions)CreateAnnotatedEndpointfrom instance.EndpointConfiggetEndpointConfig()voidonClose(Session session, CloseReason closeReason)This method is called immediately prior to the session with the remote peer being closed.voidonError(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.voidonOpen(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)
CreateAnnotatedEndpointfrom class.- Parameters:
annotatedClass- annotated class.componentProvider- used for instantiating.isServerEndpoint-trueiff 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)
CreateAnnotatedEndpointfrom class.- Parameters:
annotatedClass- annotated class.componentProvider- used for instantiating.isServerEndpoint-trueiff 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)
CreateAnnotatedEndpointfrom instance.- Parameters:
annotatedInstance- annotated instance.componentProvider- used for instantiating.isServerEndpoint-trueiff 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)
CreateAnnotatedEndpointfrom instance.- Parameters:
annotatedInstance- annotated instance.componentProvider- used for instantiating.isServerEndpoint-trueiff 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:EndpointThis 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:EndpointDevelopers 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
SessionExceptions - 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
DecodeExceptions
- 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:EndpointDevelopers must implement this method to be notified when a new conversation has just begun.Note:
- It is permitted to send messages from this method.
- It is permitted to add
MessageHandlers from this method. No messages will be mapped to the appropriateMessageHandleruntil this method has completed.
-
-