Top Description Fields Constructors Methods
org.springframework.web.socket.client.standard

public Class EndpointConnectionManager

extends ConnectionManagerSupport
implements BeanFactoryAware
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.Aware
Imports
java.util.Arrays, .List, jakarta.websocket.ClientEndpointConfig, .ClientEndpointConfig.Configurator, .ContainerProvider, .Decoder, .Encoder, .Endpoint, .Extension, .Session, .WebSocketContainer, org.springframework.beans.factory.BeanFactory, .BeanFactoryAware, org.springframework.core.task.SimpleAsyncTaskExecutor, .TaskExecutor, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.web.socket.client.ConnectionManagerSupport, org.springframework.web.socket.handler.BeanCreatingHandlerProvider

WebSocket connection manager that connects to the server via WebSocketContainer and handles the session with an Endpoint.
Author
Rossen Stoyanchev
Since
4.0
See Also
AnnotatedEndpointConnectionManager

Field Summary

Modifier and TypeField and Description
private final ClientEndpointConfig.Builder
private final Endpoint
private final BeanCreatingHandlerProvider<Endpoint>
private volatile Session
private TaskExecutor
private WebSocketContainer
Inherited from org.springframework.web.socket.client.ConnectionManagerSupport:
logger

Constructor Summary

AccessConstructor and Description
public
EndpointConnectionManager(Endpoint endpoint, String uriTemplate, Object... uriVariables)

public
EndpointConnectionManager(Class<? extends Endpoint> endpointClass, String uriTemplate, Object... uriVars)

Method Summary

Modifier and TypeMethod and Description
protected void
closeConnection()

Implements abstract org.springframework.web.socket.client.ConnectionManagerSupport.closeConnection.

Subclasses implement this to close the connection.

public TaskExecutor
getTaskExecutor()

Return the configured TaskExecutor.

public WebSocketContainer
public boolean
isConnected()

Implements abstract org.springframework.web.socket.client.ConnectionManagerSupport.isConnected.

Whether the connection is open/true or closed/false.

protected void
openConnection()

Implements abstract org.springframework.web.socket.client.ConnectionManagerSupport.openConnection.

Subclasses implement this to actually establish the connection.

public void
setBeanFactory(BeanFactory
owning BeanFactory (never null). The bean can immediately call methods on the factory.
beanFactory
)

Implements org.springframework.beans.factory.BeanFactoryAware.setBeanFactory.

Callback that supplies the owning factory to a bean instance.

public void
public void
setDecoders(List<Class<? extends Decoder>> decoders)

public void
setEncoders(List<Class<? extends Encoder>> encoders)

public void
setExtensions(Extension... extensions)

public void
public void
setTaskExecutor(TaskExecutor taskExecutor)

Set a TaskExecutor to use to open connections.

public void
Inherited from org.springframework.web.socket.client.ConnectionManagerSupport:
getPhasegetUriisAutoStartupisRunningsetAutoStartupsetPhasestartstartInternalstopstopstopInternal

Field Detail

configBuilderback to summary
private final ClientEndpointConfig.Builder configBuilder
endpointback to summary
private final Endpoint endpoint
Annotations
@Nullable
endpointProviderback to summary
private final BeanCreatingHandlerProvider<Endpoint> endpointProvider
Annotations
@Nullable
sessionback to summary
private volatile Session session
Annotations
@Nullable
taskExecutorback to summary
private TaskExecutor taskExecutor
webSocketContainerback to summary
private WebSocketContainer webSocketContainer

Constructor Detail

EndpointConnectionManagerback to summary
public EndpointConnectionManager(Endpoint endpoint, String uriTemplate, Object... uriVariables)
EndpointConnectionManagerback to summary
public EndpointConnectionManager(Class<? extends Endpoint> endpointClass, String uriTemplate, Object... uriVars)

Method Detail

closeConnectionback to summary
protected void closeConnection() throws Exception

Implements abstract org.springframework.web.socket.client.ConnectionManagerSupport.closeConnection.

Doc from org.springframework.web.socket.client.ConnectionManagerSupport.closeConnection.

Subclasses implement this to close the connection.

Annotations
@Override
getTaskExecutorback to summary
public TaskExecutor getTaskExecutor()

Return the configured TaskExecutor.

getWebSocketContainerback to summary
public WebSocketContainer getWebSocketContainer()
isConnectedback to summary
public boolean isConnected()

Implements abstract org.springframework.web.socket.client.ConnectionManagerSupport.isConnected.

Doc from org.springframework.web.socket.client.ConnectionManagerSupport.isConnected.

Whether the connection is open/true or closed/false.

Annotations
@Override
openConnectionback to summary
protected void openConnection()

Implements abstract org.springframework.web.socket.client.ConnectionManagerSupport.openConnection.

Doc from org.springframework.web.socket.client.ConnectionManagerSupport.openConnection.

Subclasses implement this to actually establish the connection.

Annotations
@Override
setBeanFactoryback to summary
public void setBeanFactory(BeanFactory beanFactory)

Implements org.springframework.beans.factory.BeanFactoryAware.setBeanFactory.

Doc from org.springframework.beans.factory.BeanFactoryAware.setBeanFactory.

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.

Parameters
beanFactory:BeanFactory

owning BeanFactory (never null). The bean can immediately call methods on the factory.

Annotations
@Override
setConfiguratorback to summary
public void setConfigurator(ClientEndpointConfig.Configurator configurator)
setDecodersback to summary
public void setDecoders(List<Class<? extends Decoder>> decoders)
setEncodersback to summary
public void setEncoders(List<Class<? extends Encoder>> encoders)
setExtensionsback to summary
public void setExtensions(Extension... extensions)
setSupportedProtocolsback to summary
public void setSupportedProtocols(String... protocols)
setTaskExecutorback to summary
public void setTaskExecutor(TaskExecutor taskExecutor)

Set a TaskExecutor to use to open connections. By default SimpleAsyncTaskExecutor is used.

setWebSocketContainerback to summary
public void setWebSocketContainer(WebSocketContainer webSocketContainer)