Top Description Inners Fields Constructors Methods
org.glassfish.tyrus.core

public Class AnnotatedEndpoint

extends Endpoint
Class Inheritance
Imports
java.lang.annotation.Annotation, java.lang.reflect.InvocationTargetException, .Method, java.util.ArrayList, .Arrays, .Collections, .HashMap, .HashSet, .Iterator, .List, .Map, .Set, java.util.logging.Level, .Logger, jakarta.websocket.ClientEndpoint, .ClientEndpointConfig, .CloseReason, .DecodeException, .Decoder, .DeploymentException, .Encoder, .Endpoint, .EndpointConfig, .Extension, .MessageHandler, .OnClose, .OnError, .OnMessage, .OnOpen, .Session, jakarta.websocket.server.PathParam, .ServerEndpoint, .ServerEndpointConfig, org.glassfish.tyrus.core.coder.PrimitiveDecoders, org.glassfish.tyrus.core.l10n.LocalizationMessages, org.glassfish.tyrus.core.monitoring.EndpointEventListener

Endpoint descendant which represents deployed annotated endpoint.
Authors
Martin Matula, Stepan Kopriva, Pavel Bucek

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract class
pack-priv static interface
pack-priv static class
private class
private class

Field Summary

Modifier and TypeField and Description
private final Class<?>
private final Object
private final ComponentProviderService
private final EndpointConfig
private final EndpointEventListener
private static final Logger
private final Set<AnnotatedEndpoint.MessageHandlerFactory>
private final Method
private final AnnotatedEndpoint.ParameterExtractor[]
private final Method
private final AnnotatedEndpoint.ParameterExtractor[]
private final Method
private final AnnotatedEndpoint.ParameterExtractor[]

Constructor Summary

AccessConstructor and Description
private
AnnotatedEndpoint(Class<?> annotatedClass, Object instance, ComponentProviderService componentProvider, Boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, EndpointEventListener endpointEventListener, Set<Extension> extensions)

Method Summary

Modifier and TypeMethod and Description
private Object
callMethod(Method method, AnnotatedEndpoint.ParameterExtractor[] extractors, Session session, boolean callOnError, Object... params)

private EndpointConfig
createEndpointConfig(Class<?> annotatedClass, boolean isServerEndpoint, ErrorCollector collector, Set<Extension> extensions)

public static AnnotatedEndpoint

Returns:

new instance.
fromClass
(Class<?>
annotated class.
annotatedClass
,
ComponentProviderService
used for instantiating.
componentProvider
,
boolean
true iff annotated endpoint is deployed on server side.
isServerEndpoint
,
int
size limit of the incoming buffer.
incomingBufferSize
,
ErrorCollector
error collector.
collector
,
EndpointEventListener
listener of monitored endpoint events.
endpointEventListener
)

Create AnnotatedEndpoint from class.

public static AnnotatedEndpoint

Returns:

new instance.
fromClass
(Class<?>
annotated class.
annotatedClass
,
ComponentProviderService
used for instantiating.
componentProvider
,
boolean
true iff annotated endpoint is deployed on server side.
isServerEndpoint
,
int
size limit of the incoming buffer.
incomingBufferSize
,
ErrorCollector
error collector.
collector
,
EndpointEventListener
listener of monitored endpoint events.
endpointEventListener
,
Set<Extension>
installed extentions.
extensions
)

Create AnnotatedEndpoint from class.

public static AnnotatedEndpoint

Returns:

new instance.
fromInstance
(Object
annotated instance.
annotatedInstance
,
ComponentProviderService
used for instantiating.
componentProvider
,
boolean
true iff annotated endpoint is deployed on server side.
isServerEndpoint
,
int
size limit of the incoming buffer
incomingBufferSize
,
ErrorCollector
error collector.
collector
)

Create AnnotatedEndpoint from instance.

public static AnnotatedEndpoint

Returns:

new instance.
fromInstance
(Object
annotated instance.
annotatedInstance
,
ComponentProviderService
used for instantiating.
componentProvider
,
boolean
true iff annotated endpoint is deployed on server side.
isServerEndpoint
,
int
size limit of the incoming buffer
incomingBufferSize
,
ErrorCollector
error collector.
collector
,
Set<Extension>
installed extentions.
extensions
)

Create AnnotatedEndpoint from instance.

pack-priv static Class<?>
getDecoderClassType(Class<? extends Decoder> decoder)

pack-priv static Class<?>
getEncoderClassType(Class<? extends Encoder> encoder)

public EndpointConfig
private AnnotatedEndpoint.ParameterExtractor[]
getOnCloseParameterExtractors(final Method method, Map<Integer, Class<?>> unknownParams, ErrorCollector collector)

private AnnotatedEndpoint.ParameterExtractor[]
getParameterExtractors(final Method method, Map<Integer, Class<?>> unknownParams, ErrorCollector collector)

private AnnotatedEndpoint.ParameterExtractor[]
getParameterExtractors(final Method method, Map<Integer, Class<?>> unknownParams, Set<Class<?>> params, ErrorCollector collector)

private String
pack-priv void
onClose(CloseReason closeReason, Session session)

public void
onClose(Session
the session about to be closed.
session
,
CloseReason
the reason the session was closed.
closeReason
)

Overrides jakarta.websocket.Endpoint.onClose.

This method is called immediately prior to the session with the remote peer being closed.

public void
onError(Session
the session in use when the error occurs.
session
,
Throwable
the throwable representing the problem.
thr
)

Overrides jakarta.websocket.Endpoint.onError.

Developers may implement this method when the web socket session creates some kind of error that is not modeled in the web socket protocol.

public void
onOpen(Session
the session that has just been activated.
session
,
EndpointConfig
the configuration used to configure this endpoint.
configuration
)

Implements abstract jakarta.websocket.Endpoint.onOpen.

Developers must implement this method to be notified when a new conversation has just begun.

Field Detail

annotatedClassback to summary
private final Class<?> annotatedClass
annotatedInstanceback to summary
private final Object annotatedInstance
componentProviderback to summary
private final ComponentProviderService componentProvider
configurationback to summary
private final EndpointConfig configuration
endpointEventListenerback to summary
private final EndpointEventListener endpointEventListener
LOGGERback to summary
private static final Logger LOGGER
messageHandlerFactoriesback to summary
private final Set<AnnotatedEndpoint.MessageHandlerFactory> messageHandlerFactories
onCloseMethodback to summary
private final Method onCloseMethod
onCloseParametersback to summary
private final AnnotatedEndpoint.ParameterExtractor[] onCloseParameters
onErrorMethodback to summary
private final Method onErrorMethod
onErrorParametersback to summary
private final AnnotatedEndpoint.ParameterExtractor[] onErrorParameters
onOpenMethodback to summary
private final Method onOpenMethod
onOpenParametersback to summary
private final AnnotatedEndpoint.ParameterExtractor[] onOpenParameters

Constructor Detail

AnnotatedEndpointback to summary
private AnnotatedEndpoint(Class<?> annotatedClass, Object instance, ComponentProviderService componentProvider, Boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, EndpointEventListener endpointEventListener, Set<Extension> extensions)

Method Detail

callMethodback to summary
private Object callMethod(Method method, AnnotatedEndpoint.ParameterExtractor[] extractors, Session session, boolean callOnError, Object... params)
createEndpointConfigback to summary
private EndpointConfig createEndpointConfig(Class<?> annotatedClass, boolean isServerEndpoint, ErrorCollector collector, Set<Extension> extensions)
fromClassback to summary
public static AnnotatedEndpoint fromClass(Class<?> annotatedClass, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, EndpointEventListener endpointEventListener)

Create AnnotatedEndpoint from class.

Parameters
annotatedClass:Class<?>

annotated class.

componentProvider:ComponentProviderService

used for instantiating.

isServerEndpoint:boolean

true iff annotated endpoint is deployed on server side.

incomingBufferSize:int

size limit of the incoming buffer.

collector:ErrorCollector

error collector.

endpointEventListener:EndpointEventListener

listener of monitored endpoint events.

Returns:AnnotatedEndpoint

new instance.

fromClassback to summary
public static AnnotatedEndpoint fromClass(Class<?> annotatedClass, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, EndpointEventListener endpointEventListener, Set<Extension> extensions)

Create AnnotatedEndpoint from class.

Parameters
annotatedClass:Class<?>

annotated class.

componentProvider:ComponentProviderService

used for instantiating.

isServerEndpoint:boolean

true iff annotated endpoint is deployed on server side.

incomingBufferSize:int

size limit of the incoming buffer.

collector:ErrorCollector

error collector.

endpointEventListener:EndpointEventListener

listener of monitored endpoint events.

extensions:Set<Extension>

installed extentions.

Returns:AnnotatedEndpoint

new instance.

fromInstanceback to summary
public static AnnotatedEndpoint fromInstance(Object annotatedInstance, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector)

Create AnnotatedEndpoint from instance.

Parameters
annotatedInstance:Object

annotated instance.

componentProvider:ComponentProviderService

used for instantiating.

isServerEndpoint:boolean

true iff annotated endpoint is deployed on server side.

incomingBufferSize:int

size limit of the incoming buffer

collector:ErrorCollector

error collector.

Returns:AnnotatedEndpoint

new instance.

fromInstanceback to summary
public static AnnotatedEndpoint fromInstance(Object annotatedInstance, ComponentProviderService componentProvider, boolean isServerEndpoint, int incomingBufferSize, ErrorCollector collector, Set<Extension> extensions)

Create AnnotatedEndpoint from instance.

Parameters
annotatedInstance:Object

annotated instance.

componentProvider:ComponentProviderService

used for instantiating.

isServerEndpoint:boolean

true iff annotated endpoint is deployed on server side.

incomingBufferSize:int

size limit of the incoming buffer

collector:ErrorCollector

error collector.

extensions:Set<Extension>

installed extentions.

Returns:AnnotatedEndpoint

new instance.

getDecoderClassTypeback to summary
pack-priv static Class<?> getDecoderClassType(Class<? extends Decoder> decoder)
getEncoderClassTypeback to summary
pack-priv static Class<?> getEncoderClassType(Class<? extends Encoder> encoder)
getEndpointConfigback to summary
public EndpointConfig getEndpointConfig()
getOnCloseParameterExtractorsback to summary
private AnnotatedEndpoint.ParameterExtractor[] getOnCloseParameterExtractors(final Method method, Map<Integer, Class<?>> unknownParams, ErrorCollector collector)
getParameterExtractorsback to summary
private AnnotatedEndpoint.ParameterExtractor[] getParameterExtractors(final Method method, Map<Integer, Class<?>> unknownParams, ErrorCollector collector)
getParameterExtractorsback to summary
private AnnotatedEndpoint.ParameterExtractor[] getParameterExtractors(final Method method, Map<Integer, Class<?>> unknownParams, Set<Class<?>> params, ErrorCollector collector)
getPathParamNameback to summary
private String getPathParamName(Annotation[] annotations)
onCloseback to summary
pack-priv void onClose(CloseReason closeReason, Session session)
onCloseback to summary
public void onClose(Session session, CloseReason closeReason)

Overrides jakarta.websocket.Endpoint.onClose.

Doc from jakarta.websocket.Endpoint.onClose.

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.

Parameters
session:Session

the session about to be closed.

closeReason:CloseReason

the reason the session was closed.

Annotations
@Override
onErrorback to summary
public void onError(Session session, Throwable thr)

Overrides jakarta.websocket.Endpoint.onError.

Doc from jakarta.websocket.Endpoint.onError.

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 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
Parameters
session:Session

the session in use when the error occurs.

thr:Throwable

the throwable representing the problem.

Annotations
@Override
onOpenback to summary
public void onOpen(Session session, EndpointConfig configuration)

Implements abstract jakarta.websocket.Endpoint.onOpen.

Doc from jakarta.websocket.Endpoint.onOpen.

Developers 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 appropriate MessageHandler until this method has completed.
Parameters
session:Session

the session that has just been activated.

configuration:EndpointConfig

the configuration used to configure this endpoint.

Annotations
@Override
org.glassfish.tyrus.core back to summary

private abstract Class AnnotatedEndpoint.MessageHandlerFactory

extends Object
Class Inheritance
  • java.lang.Object
  • org.glassfish.tyrus.core.AnnotatedEndpoint.MessageHandlerFactory
Known Direct Subclasses
org.glassfish.tyrus.core.AnnotatedEndpoint.WholeHandler, org.glassfish.tyrus.core.AnnotatedEndpoint.PartialHandler

Field Summary

Modifier and TypeField and Description
pack-priv final AnnotatedEndpoint.ParameterExtractor[]
pack-priv final long
pack-priv final Method
pack-priv final Class<?>

Constructor Summary

AccessConstructor and Description
pack-priv
MessageHandlerFactory(Method method, AnnotatedEndpoint.ParameterExtractor[] extractors, Class<?> type, long maxMessageSize)

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract MessageHandler
create(Session session)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

extractorsback to summary
pack-priv final AnnotatedEndpoint.ParameterExtractor[] extractors
maxMessageSizeback to summary
pack-priv final long maxMessageSize
methodback to summary
pack-priv final Method method
typeback to summary
pack-priv final Class<?> type

Constructor Detail

MessageHandlerFactoryback to summary
pack-priv MessageHandlerFactory(Method method, AnnotatedEndpoint.ParameterExtractor[] extractors, Class<?> type, long maxMessageSize)

Method Detail

createback to summary
pack-priv abstract MessageHandler create(Session session)
org.glassfish.tyrus.core back to summary

pack-priv Interface AnnotatedEndpoint.ParameterExtractor

Known Direct Implementers
org.glassfish.tyrus.core.AnnotatedEndpoint.ParamValue

Method Summary

Modifier and TypeMethod and Description
public Object
value(Session session, Object... paramValues)

Method Detail

valueback to summary
public Object value(Session session, Object... paramValues) throws DecodeException
org.glassfish.tyrus.core back to summary

pack-priv Class AnnotatedEndpoint.ParamValue

extends Object
implements ParameterExtractor
Class Inheritance
All Implemented Interfaces
org.glassfish.tyrus.core.AnnotatedEndpoint.ParameterExtractor

Field Summary

Modifier and TypeField and Description
private final int

Constructor Summary

AccessConstructor and Description
pack-priv
ParamValue(int index)

Method Summary

Modifier and TypeMethod and Description
public Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

indexback to summary
private final int index

Constructor Detail

ParamValueback to summary
pack-priv ParamValue(int index)

Method Detail

valueback to summary
public Object value(Session session, Object... paramValues)

Implements org.glassfish.tyrus.core.AnnotatedEndpoint.ParameterExtractor.value.

Annotations
@Override
org.glassfish.tyrus.core back to summary

private Class AnnotatedEndpoint.PartialHandler

extends MessageHandlerFactory
Class Inheritance

Field Summary

Inherited from org.glassfish.tyrus.core.AnnotatedEndpoint.MessageHandlerFactory:
extractorsmaxMessageSizemethodtype

Constructor Summary

AccessConstructor and Description
pack-priv
PartialHandler(Method method, AnnotatedEndpoint.ParameterExtractor[] extractors, Class<?> type, long maxMessageSize)

Method Summary

Modifier and TypeMethod and Description
public MessageHandler

Constructor Detail

PartialHandlerback to summary
pack-priv PartialHandler(Method method, AnnotatedEndpoint.ParameterExtractor[] extractors, Class<?> type, long maxMessageSize)

Method Detail

createback to summary
public MessageHandler create(final Session session)

Implements abstract org.glassfish.tyrus.core.AnnotatedEndpoint.MessageHandlerFactory.create.

Annotations
@Override
org.glassfish.tyrus.core back to summary

private Class AnnotatedEndpoint.WholeHandler

extends MessageHandlerFactory
Class Inheritance

Field Summary

Inherited from org.glassfish.tyrus.core.AnnotatedEndpoint.MessageHandlerFactory:
extractorsmaxMessageSizemethodtype

Constructor Summary

AccessConstructor and Description
pack-priv
WholeHandler(Method method, AnnotatedEndpoint.ParameterExtractor[] extractors, Class<?> type, long maxMessageSize)

Method Summary

Modifier and TypeMethod and Description
public MessageHandler

Constructor Detail

WholeHandlerback to summary
pack-priv WholeHandler(Method method, AnnotatedEndpoint.ParameterExtractor[] extractors, Class<?> type, long maxMessageSize)

Method Detail

createback to summary
public MessageHandler create(final Session session)

Implements abstract org.glassfish.tyrus.core.AnnotatedEndpoint.MessageHandlerFactory.create.

Annotations
@Override