public class AnnotatedEndpointConnectionManager extends ConnectionManagerSupport implements BeanFactoryAware
ServerEndpoint
-annotated
endpoint, connects to a WebSocket server through the ConnectionManagerSupport.start()
and
ConnectionManagerSupport.stop()
methods. If ConnectionManagerSupport.setAutoStartup(boolean)
is set to true
this will be done automatically when the Spring ApplicationContext is refreshed.Modifier and Type | Field and Description |
---|---|
private java.lang.Object |
endpoint |
private BeanCreatingHandlerProvider<java.lang.Object> |
endpointProvider |
private Session |
session |
private TaskExecutor |
taskExecutor |
private WebSocketContainer |
webSocketContainer |
logger
Constructor and Description |
---|
AnnotatedEndpointConnectionManager(java.lang.Class<?> endpointClass,
java.lang.String uriTemplate,
java.lang.Object... uriVariables) |
AnnotatedEndpointConnectionManager(java.lang.Object endpoint,
java.lang.String uriTemplate,
java.lang.Object... uriVariables) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeConnection() |
TaskExecutor |
getTaskExecutor()
Return the configured
TaskExecutor . |
WebSocketContainer |
getWebSocketContainer() |
protected boolean |
isConnected() |
protected void |
openConnection() |
void |
setBeanFactory(BeanFactory beanFactory)
Callback that supplies the owning factory to a bean instance.
|
void |
setTaskExecutor(TaskExecutor taskExecutor)
Set a
TaskExecutor to use to open the connection. |
void |
setWebSocketContainer(WebSocketContainer webSocketContainer) |
getPhase, getUri, isAutoStartup, isRunning, setAutoStartup, setPhase, start, startInternal, stop, stop, stopInternal
private final java.lang.Object endpoint
private final BeanCreatingHandlerProvider<java.lang.Object> endpointProvider
private WebSocketContainer webSocketContainer
private Session session
private TaskExecutor taskExecutor
public AnnotatedEndpointConnectionManager(java.lang.Object endpoint, java.lang.String uriTemplate, java.lang.Object... uriVariables)
public AnnotatedEndpointConnectionManager(java.lang.Class<?> endpointClass, java.lang.String uriTemplate, java.lang.Object... uriVariables)
public void setWebSocketContainer(WebSocketContainer webSocketContainer)
public WebSocketContainer getWebSocketContainer()
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
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.BeansException
- in case of initialization errorsBeanInitializationException
public void setTaskExecutor(TaskExecutor taskExecutor)
TaskExecutor
to use to open the connection.
By default SimpleAsyncTaskExecutor
is used.public TaskExecutor getTaskExecutor()
TaskExecutor
.protected void openConnection()
openConnection
in class ConnectionManagerSupport
protected void closeConnection() throws java.lang.Exception
closeConnection
in class ConnectionManagerSupport
java.lang.Exception
protected boolean isConnected()
isConnected
in class ConnectionManagerSupport