Class AnnotatedEndpointConnectionManager
- java.lang.Object
- org.springframework.web.socket.client.ConnectionManagerSupport
- org.springframework.web.socket.client.standard.AnnotatedEndpointConnectionManager
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,Lifecycle
,Phased
,SmartLifecycle
public class AnnotatedEndpointConnectionManager extends ConnectionManagerSupport implements BeanFactoryAware
A WebSocket connection manager that is given a URI, aClientEndpoint
-annotated endpoint, connects to a WebSocket server through theConnectionManagerSupport.start()
andConnectionManagerSupport.stop()
methods. IfConnectionManagerSupport.setAutoStartup(boolean)
is set totrue
this will be done automatically when the Spring ApplicationContext is refreshed.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
Field Summary
Fields inherited from class org.springframework.web.socket.client.ConnectionManagerSupport
logger
Constructor Summary
Constructors Constructor Description AnnotatedEndpointConnectionManager(Class<?> endpointClass, String uriTemplate, Object... uriVariables)
AnnotatedEndpointConnectionManager(Object endpoint, String uriTemplate, Object... uriVariables)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeConnection()
TaskExecutor
getTaskExecutor()
Return the configuredTaskExecutor
.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 aTaskExecutor
to use to open the connection.void
setWebSocketContainer(WebSocketContainer webSocketContainer)
Methods inherited from class org.springframework.web.socket.client.ConnectionManagerSupport
getPhase, getUri, isAutoStartup, isRunning, setAutoStartup, setPhase, start, startInternal, stop, stop, stopInternal
Constructor Detail
AnnotatedEndpointConnectionManager
public AnnotatedEndpointConnectionManager(Object endpoint, String uriTemplate, Object... uriVariables)
AnnotatedEndpointConnectionManager
public AnnotatedEndpointConnectionManager(Class<?> endpointClass, String uriTemplate, Object... uriVariables)
Method Detail
setWebSocketContainer
public void setWebSocketContainer(WebSocketContainer webSocketContainer)
getWebSocketContainer
public WebSocketContainer getWebSocketContainer()
setBeanFactory
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
Description copied from interface:BeanFactoryAware
Callback that supplies the owning factory to a bean instance.Invoked after the population of normal bean properties but before an initialization callback such as
InitializingBean.afterPropertiesSet()
or a custom init-method.- Specified by:
setBeanFactory
in interfaceBeanFactoryAware
- Parameters:
beanFactory
- owning BeanFactory (nevernull
). The bean can immediately call methods on the factory.- Throws:
BeansException
- in case of initialization errors- See Also:
BeanInitializationException
setTaskExecutor
public void setTaskExecutor(TaskExecutor taskExecutor)
Set aTaskExecutor
to use to open the connection. By defaultSimpleAsyncTaskExecutor
is used.
getTaskExecutor
public TaskExecutor getTaskExecutor()
Return the configuredTaskExecutor
.
openConnection
protected void openConnection()
- Specified by:
openConnection
in classConnectionManagerSupport
closeConnection
protected void closeConnection() throws Exception
- Specified by:
closeConnection
in classConnectionManagerSupport
- Throws:
Exception
isConnected
protected boolean isConnected()
- Specified by:
isConnected
in classConnectionManagerSupport