public class EndpointConnectionManager extends ConnectionManagerSupport implements BeanFactoryAware
connection manager
that connects
to the server via WebSocketContainer
and handles the session with an
Endpoint
.AnnotatedEndpointConnectionManager
logger
DEFAULT_PHASE
Constructor and Description |
---|
EndpointConnectionManager(Class<? extends Endpoint> endpointClass,
String uriTemplate,
Object... uriVars) |
EndpointConnectionManager(Endpoint endpoint,
String uriTemplate,
Object... uriVariables) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeConnection()
Subclasses implement this to close the connection.
|
TaskExecutor |
getTaskExecutor()
Return the configured
TaskExecutor . |
WebSocketContainer |
getWebSocketContainer() |
boolean |
isConnected()
Whether the connection is open/
true or closed/false . |
protected void |
openConnection()
Subclasses implement this to actually establish the connection.
|
void |
setBeanFactory(BeanFactory beanFactory)
Callback that supplies the owning factory to a bean instance.
|
void |
setConfigurator(ClientEndpointConfig.Configurator configurator) |
void |
setDecoders(List<Class<? extends Decoder>> decoders) |
void |
setEncoders(List<Class<? extends Encoder>> encoders) |
void |
setExtensions(Extension... extensions) |
void |
setSupportedProtocols(String... protocols) |
void |
setTaskExecutor(TaskExecutor taskExecutor)
Set a
TaskExecutor to use to open connections. |
void |
setWebSocketContainer(WebSocketContainer webSocketContainer) |
getPhase, getUri, isAutoStartup, isRunning, setAutoStartup, setPhase, start, startInternal, stop, stop, stopInternal
public EndpointConnectionManager(Endpoint endpoint, String uriTemplate, Object... uriVariables)
public void setSupportedProtocols(String... protocols)
public void setExtensions(Extension... extensions)
public void setConfigurator(ClientEndpointConfig.Configurator configurator)
public void setWebSocketContainer(WebSocketContainer webSocketContainer)
public WebSocketContainer getWebSocketContainer()
public void setBeanFactory(BeanFactory beanFactory)
BeanFactoryAware
Invoked after the population of normal bean properties
but before an initialization callback such as
InitializingBean.afterPropertiesSet()
or a custom init-method.
setBeanFactory
in interface BeanFactoryAware
beanFactory
- owning BeanFactory (never null
).
The bean can immediately call methods on the factory.BeanInitializationException
public void setTaskExecutor(TaskExecutor taskExecutor)
TaskExecutor
to use to open connections.
By default SimpleAsyncTaskExecutor
is used.public TaskExecutor getTaskExecutor()
TaskExecutor
.public boolean isConnected()
ConnectionManagerSupport
true
or closed/false
.isConnected
in class ConnectionManagerSupport
protected void openConnection()
ConnectionManagerSupport
openConnection
in class ConnectionManagerSupport
protected void closeConnection() throws Exception
ConnectionManagerSupport
closeConnection
in class ConnectionManagerSupport
Exception