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
WebSocket
connection manager
that connects
to the server via WebSocketContainer
and handles the session with an
@ClientEndpoint
endpoint.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
-
Field Summary
Fields inherited from class org.springframework.web.socket.client.ConnectionManagerSupport
logger
Fields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE
-
Constructor Summary
ConstructorsConstructorDescriptionAnnotatedEndpointConnectionManager
(Class<?> endpointClass, String uriTemplate, @Nullable Object... uriVariables) AnnotatedEndpointConnectionManager
(Object endpoint, String uriTemplate, @Nullable Object... uriVariables) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Subclasses implement this to close the connection.Return the configuredTaskExecutor
.boolean
Whether the connection is open/true
or closed/false
.protected void
Subclasses implement this to actually establish the connection.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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.SmartLifecycle
isPauseable
-
Constructor Details
-
AnnotatedEndpointConnectionManager
-
AnnotatedEndpointConnectionManager
-
-
Method Details
-
setWebSocketContainer
-
getWebSocketContainer
-
setBeanFactory
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:
-
setTaskExecutor
Set aTaskExecutor
to use to open the connection. By defaultSimpleAsyncTaskExecutor
is used. -
getTaskExecutor
Return the configuredTaskExecutor
. -
isConnected
public boolean isConnected()Description copied from class:ConnectionManagerSupport
Whether the connection is open/true
or closed/false
.- Specified by:
isConnected
in classConnectionManagerSupport
-
openConnection
protected void openConnection()Description copied from class:ConnectionManagerSupport
Subclasses implement this to actually establish the connection.- Specified by:
openConnection
in classConnectionManagerSupport
-
closeConnection
Description copied from class:ConnectionManagerSupport
Subclasses implement this to close the connection.- Specified by:
closeConnection
in classConnectionManagerSupport
- Throws:
Exception
-