public class ComponentProviderService
extends java.lang.Object
ComponentProviders which are used to provide
instances.| Constructor and Description |
|---|
ComponentProviderService(ComponentProviderService componentProviderService)
Copy constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static ComponentProviderService |
create()
Create new instance of
ComponentProviderService. |
static ComponentProviderService |
createClient()
Create new instance of
ComponentProviderService. |
<T> java.lang.Object |
getCoderInstance(java.lang.Class<T> c,
Session session,
EndpointConfig endpointConfig,
ErrorCollector collector)
|
<T> java.lang.Object |
getEndpointInstance(java.lang.Class<T> endpointClass)
This method is called by the container each time a new client
connects to the logical endpoint this configurator configures.
|
<T> java.lang.Object |
getInstance(java.lang.Class<T> c,
Session session,
ErrorCollector collector)
Provide an instance of class which is coupled to
Session. |
java.lang.reflect.Method |
getInvocableMethod(java.lang.reflect.Method method) |
void |
removeSession(Session session)
Remove
Session from cache. |
public ComponentProviderService(ComponentProviderService componentProviderService)
componentProviderService - original instance.public static ComponentProviderService create()
ComponentProviderService.
Searches for registered ComponentProviders and registers them with this service.
DefaultComponentProvider is always added to found providers.
ComponentProviderService.public static ComponentProviderService createClient()
ComponentProviderService.
Contains *only* DefaultComponentProvider. Used for creating client instances (CDI/EJB container are
often confused and using them to retrieve instances leads to unstable results since the injection scope is not
properly defined for these cases). See https://java.net/jira/browse/WEBSOCKET_SPEC-197 and
https://java.net/jira/browse/WEBSOCKET_SPEC-196.
ComponentProviderService.public <T> java.lang.Object getInstance(java.lang.Class<T> c,
Session session,
ErrorCollector collector)
Session.
The first time the method is called the provider creates an instance and caches it. Next time the method is called the cached instance is returned.
T - type of the provided instance.c - Class whose instance will be provided.session - session to which the instance belongs (think of this as a scope).collector - error collector.public <T> java.lang.Object getCoderInstance(java.lang.Class<T> c,
Session session,
EndpointConfig endpointConfig,
ErrorCollector collector)
Encoder or Decoder descendant which is
coupled to Session.
The first time the method is called the provider creates an instance, calls Encoder.init(javax.websocket.EndpointConfig)
or Decoder.init(javax.websocket.EndpointConfig) and caches it.
Next time the method is called the cached instance is returned.
T - type of the provided instance.c - Class whose instance will be provided.session - session to which the instance belongs (think of this as a scope).collector - error collector.endpointConfig - configuration corresponding to current context. Used for
Encoder.init(javax.websocket.EndpointConfig) and
Decoder.init(javax.websocket.EndpointConfig)public java.lang.reflect.Method getInvocableMethod(java.lang.reflect.Method method)
public void removeSession(Session session)
Session from cache.session - to be removed.public <T> java.lang.Object getEndpointInstance(java.lang.Class<T> endpointClass)
throws java.lang.InstantiationException
T - the type of the endpoint.endpointClass - the class of the endpoint.java.lang.InstantiationException - if there was an error producing the
endpoint instance.ServerEndpointConfig.Configurator.getEndpointInstance(Class)Copyright © 2012–2025 Oracle Corporation. All rights reserved.