Package org.glassfish.tyrus.core
Class AnnotatedEndpoint
java.lang.Object
jakarta.websocket.Endpoint
org.glassfish.tyrus.core.AnnotatedEndpoint
Endpoint descendant which represents deployed annotated endpoint.- Author:
- Martin Matula, Stepan Kopriva, Pavel Bucek
-
Method Summary
Modifier and TypeMethodDescriptionstatic AnnotatedEndpointfromClass(Class<?> annotatedClass, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, EndpointEventListener endpointEventListener) CreateAnnotatedEndpointfrom class.static AnnotatedEndpointfromClass(Class<?> annotatedClass, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, EndpointEventListener endpointEventListener, Set<Extension> extensions) CreateAnnotatedEndpointfrom class.static AnnotatedEndpointfromInstance(Object annotatedInstance, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector) CreateAnnotatedEndpointfrom instance.static AnnotatedEndpointfromInstance(Object annotatedInstance, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, Set<Extension> extensions) CreateAnnotatedEndpointfrom instance.voidonClose(Session session, CloseReason closeReason) This method is called immediately prior to the session with the remote peer being closed.voidDevelopers 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 Details
-
fromClass
public static AnnotatedEndpoint fromClass(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(Class<?> annotatedClass, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, EndpointEventListener endpointEventListener, 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(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(Object annotatedInstance, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, 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
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
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
-
onOpen
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.
-