Class EndpointConnectionManager
java.lang.Object
org.springframework.web.socket.client.ConnectionManagerSupport
org.springframework.web.socket.client.standard.EndpointConnectionManager
- All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
public class EndpointConnectionManager
extends ConnectionManagerSupport
implements org.springframework.beans.factory.BeanFactoryAware
WebSocket
connection manager that connects
to the server via WebSocketContainer and handles the session with an
Endpoint.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Field Summary
Fields inherited from class ConnectionManagerSupport
loggerFields inherited from interface org.springframework.context.SmartLifecycle
DEFAULT_PHASE -
Constructor Summary
ConstructorsConstructorDescriptionEndpointConnectionManager(jakarta.websocket.Endpoint endpoint, String uriTemplate, @Nullable Object... uriVariables) EndpointConnectionManager(Class<? extends jakarta.websocket.Endpoint> endpointClass, String uriTemplate, @Nullable Object... uriVars) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidSubclasses implement this to close the connection.org.springframework.core.task.TaskExecutorReturn the configuredTaskExecutor.jakarta.websocket.WebSocketContainerbooleanWhether the connection is open/trueor closed/false.protected voidSubclasses implement this to actually establish the connection.voidsetBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) voidsetConfigurator(jakarta.websocket.ClientEndpointConfig.Configurator configurator) voidsetDecoders(List<Class<? extends jakarta.websocket.Decoder>> decoders) voidsetEncoders(List<Class<? extends jakarta.websocket.Encoder>> encoders) voidsetExtensions(jakarta.websocket.Extension... extensions) voidsetSupportedProtocols(String... protocols) voidsetTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor) Set aTaskExecutorto use to open connections.voidsetWebSocketContainer(jakarta.websocket.WebSocketContainer webSocketContainer) Methods inherited from class ConnectionManagerSupport
getPhase, getUri, isAutoStartup, isRunning, setAutoStartup, setPhase, start, startInternal, stop, stop, stopInternalMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.SmartLifecycle
isPauseable
-
Constructor Details
-
EndpointConnectionManager
-
EndpointConnectionManager
-
-
Method Details
-
setSupportedProtocols
-
setExtensions
public void setExtensions(jakarta.websocket.Extension... extensions) -
setEncoders
-
setDecoders
-
setConfigurator
public void setConfigurator(jakarta.websocket.ClientEndpointConfig.Configurator configurator) -
setWebSocketContainer
public void setWebSocketContainer(jakarta.websocket.WebSocketContainer webSocketContainer) -
getWebSocketContainer
public jakarta.websocket.WebSocketContainer getWebSocketContainer() -
setBeanFactory
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) - Specified by:
setBeanFactoryin interfaceorg.springframework.beans.factory.BeanFactoryAware
-
setTaskExecutor
public void setTaskExecutor(org.springframework.core.task.TaskExecutor taskExecutor) Set aTaskExecutorto use to open connections. By defaultSimpleAsyncTaskExecutoris used. -
getTaskExecutor
public org.springframework.core.task.TaskExecutor getTaskExecutor()Return the configuredTaskExecutor. -
isConnected
public boolean isConnected()Description copied from class:ConnectionManagerSupportWhether the connection is open/trueor closed/false.- Specified by:
isConnectedin classConnectionManagerSupport
-
openConnection
protected void openConnection()Description copied from class:ConnectionManagerSupportSubclasses implement this to actually establish the connection.- Specified by:
openConnectionin classConnectionManagerSupport
-
closeConnection
Description copied from class:ConnectionManagerSupportSubclasses implement this to close the connection.- Specified by:
closeConnectionin classConnectionManagerSupport- Throws:
Exception
-