public class EndpointConnectionManager extends ConnectionManagerSupport implements BeanFactoryAware
Endpoint, connects to a
WebSocket server through the ConnectionManagerSupport.start() and ConnectionManagerSupport.stop() methods. If
ConnectionManagerSupport.setAutoStartup(boolean) is set to true this will be done automatically
when the Spring ApplicationContext is refreshed.AnnotatedEndpointConnectionManager| Modifier and Type | Field and Description |
|---|---|
private ClientEndpointConfig.Builder |
configBuilder |
private Endpoint |
endpoint |
private BeanCreatingHandlerProvider<Endpoint> |
endpointProvider |
private Session |
session |
private TaskExecutor |
taskExecutor |
private WebSocketContainer |
webSocketContainer |
logger| Constructor and Description |
|---|
EndpointConnectionManager(Endpoint endpoint,
java.lang.String uriTemplate,
java.lang.Object... uriVariables) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
closeConnection() |
TaskExecutor |
getTaskExecutor()
Return the configured
TaskExecutor. |
WebSocketContainer |
getWebSocketContainer() |
protected boolean |
isConnected() |
protected void |
openConnection() |
void |
setBeanFactory(BeanFactory beanFactory)
Callback that supplies the owning factory to a bean instance.
|
void |
setConfigurator(Configurator configurator) |
void |
setDecoders(java.util.List<java.lang.Class<? extends Decoder>> decoders) |
void |
setEncoders(java.util.List<java.lang.Class<? extends Encoder>> encoders) |
void |
setExtensions(Extension... extensions) |
void |
setSupportedProtocols(java.lang.String... protocols) |
void |
setTaskExecutor(TaskExecutor taskExecutor)
Set a
TaskExecutor to use to open connections. |
void |
setWebSocketContainer(WebSocketContainer webSocketContainer) |
getPhase, getUri, isAutoStartup, isRunning, setAutoStartup, setPhase, start, startInternal, stop, stop, stopInternalprivate final Endpoint endpoint
private final BeanCreatingHandlerProvider<Endpoint> endpointProvider
private final ClientEndpointConfig.Builder configBuilder
private WebSocketContainer webSocketContainer
private Session session
private TaskExecutor taskExecutor
public EndpointConnectionManager(Endpoint endpoint,
java.lang.String uriTemplate,
java.lang.Object... uriVariables)
public void setSupportedProtocols(java.lang.String... protocols)
public void setExtensions(Extension... extensions)
public void setEncoders(java.util.List<java.lang.Class<? extends Encoder>> encoders)
public void setDecoders(java.util.List<java.lang.Class<? extends Decoder>> decoders)
public void setConfigurator(Configurator configurator)
public void setWebSocketContainer(WebSocketContainer webSocketContainer)
public WebSocketContainer getWebSocketContainer()
public void setBeanFactory(BeanFactory beanFactory) throws BeansException
BeanFactoryAwareInvoked after the population of normal bean properties
but before an initialization callback such as
InitializingBean.afterPropertiesSet() or a custom init-method.
setBeanFactory in interface BeanFactoryAwarebeanFactory - owning BeanFactory (never null).
The bean can immediately call methods on the factory.BeansException - in case of initialization errorsBeanInitializationExceptionpublic void setTaskExecutor(TaskExecutor taskExecutor)
TaskExecutor to use to open connections.
By default SimpleAsyncTaskExecutor is used.public TaskExecutor getTaskExecutor()
TaskExecutor.protected void openConnection()
openConnection in class ConnectionManagerSupportprotected void closeConnection()
throws java.lang.Exception
closeConnection in class ConnectionManagerSupportjava.lang.Exceptionprotected boolean isConnected()
isConnected in class ConnectionManagerSupport