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

public Class AnnotatedEndpointConnectionManager

extends ConnectionManagerSupport
implements BeanFactoryAware
Class Inheritance
All Implemented Interfaces
org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.Aware
Imports
jakarta.websocket.ContainerProvider, .Session, .WebSocketContainer, org.springframework.beans.BeansException, 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 @ClientEndpoint endpoint.
Author
Rossen Stoyanchev
Since
4.0

Field Summary

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

Constructor Summary

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

public
AnnotatedEndpointConnectionManager(Class<?> endpointClass, String uriTemplate, Object... uriVariables)

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
setTaskExecutor(TaskExecutor taskExecutor)

Set a TaskExecutor to use to open the connection.

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

Field Detail

endpointback to summary
private final Object endpoint
Annotations
@Nullable
endpointProviderback to summary
private final BeanCreatingHandlerProvider<Object> 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

AnnotatedEndpointConnectionManagerback to summary
public AnnotatedEndpointConnectionManager(Object endpoint, String uriTemplate, Object... uriVariables)
AnnotatedEndpointConnectionManagerback to summary
public AnnotatedEndpointConnectionManager(Class<?> endpointClass, String uriTemplate, Object... uriVariables)

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) throws BeansException

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
Exceptions
BeansException:
in case of initialization errors
setTaskExecutorback to summary
public void setTaskExecutor(TaskExecutor taskExecutor)

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

setWebSocketContainerback to summary
public void setWebSocketContainer(WebSocketContainer webSocketContainer)