Class ServerWebSocketContainer
java.lang.Object
org.springframework.integration.websocket.IntegrationWebSocketContainer
org.springframework.integration.websocket.ServerWebSocketContainer
- All Implemented Interfaces:
- DisposableBean,- Lifecycle,- Phased,- SmartLifecycle,- WebSocketConfigurer
public class ServerWebSocketContainer
extends IntegrationWebSocketContainer
implements WebSocketConfigurer, SmartLifecycle
The 
IntegrationWebSocketContainer implementation for the server
 WebSocketHandler registration.
 
 Registers an internal IntegrationWebSocketContainer.IntegrationWebSocketHandler
 for provided paths with the WebSocketHandlerRegistry.
 
 The real registration is based on Spring Web-Socket infrastructure via WebSocketConfigurer
 implementation of this class.
- Since:
- 4.1
- Author:
- Artem Bilan, Gary Russell, Christian Tzolov
- 
Nested Class SummaryNested Classes
- 
Field SummaryFields inherited from class org.springframework.integration.websocket.IntegrationWebSocketContainerDEFAULT_SEND_BUFFER_SIZE, DEFAULT_SEND_TIME_LIMIT, lock, logger, sessionsFields inherited from interface org.springframework.context.SmartLifecycleDEFAULT_PHASE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintgetPhase()booleanbooleanvoidsetAllowedOrigins(String... origins) Configure allowedOriginheader values.voidsetAutoStartup(boolean autoStartup) setDecoratorFactories(WebSocketHandlerDecoratorFactory... factories) Configure one or more factories to decorate the handler used to process WebSocket messages.setHandshakeHandler(HandshakeHandler handshakeHandler) setInterceptors(HandshakeInterceptor... interceptors) voidsetPhase(int phase) voidsetSockJsServiceOptions(ServerWebSocketContainer.SockJsServiceOptions sockJsServiceOptions) voidsetSockJsTaskScheduler(TaskScheduler sockJsTaskScheduler) Configure aTaskSchedulerfor SockJS fallback service.voidstart()voidstop()voidwithSockJs(ServerWebSocketContainer.SockJsServiceOptions... sockJsServiceOptions) Methods inherited from class org.springframework.integration.websocket.IntegrationWebSocketContaineraddSupportedProtocols, closeSession, destroy, getSession, getSessions, getSubProtocols, getWebSocketHandler, setMessageListener, setSendBufferOverflowStrategy, setSendBufferSizeLimit, setSendTimeLimit, setSupportedProtocols, setWebSocketHandler
- 
Constructor Details- 
ServerWebSocketContainer
 
- 
- 
Method Details- 
setHandshakeHandler
- 
setInterceptors
- 
setDecoratorFactoriespublic ServerWebSocketContainer setDecoratorFactories(WebSocketHandlerDecoratorFactory... factories) Configure one or more factories to decorate the handler used to process WebSocket messages. This may be useful in some advanced use cases, for example to allow Spring Security to forcibly close the WebSocket session when the corresponding HTTP session expires.- Parameters:
- factories- the WebSocketHandlerDecoratorFactory array to use
- Returns:
- the current ServerWebSocketContainer
- Since:
- 4.2
 
- 
setAllowedOriginsConfigure allowedOriginheader values.- Parameters:
- origins- the origins to allow.
- Returns:
- the current ServerWebSocketContainer
- Since:
- 4.3
- See Also:
 
- 
withSockJspublic ServerWebSocketContainer withSockJs(ServerWebSocketContainer.SockJsServiceOptions... sockJsServiceOptions) 
- 
setSockJsServiceOptionspublic void setSockJsServiceOptions(ServerWebSocketContainer.SockJsServiceOptions sockJsServiceOptions) 
- 
setSockJsTaskSchedulerConfigure aTaskSchedulerfor SockJS fallback service. This is an alternative for default SockJS service scheduler when Websocket endpoint (this server container) is registered at runtime.- Parameters:
- sockJsTaskScheduler- the- TaskSchedulerfor SockJS fallback service.
- Since:
- 5.5.1
 
- 
getSockJsTaskScheduler
- 
registerWebSocketHandlers- Specified by:
- registerWebSocketHandlersin interface- WebSocketConfigurer
 
- 
setAutoStartuppublic void setAutoStartup(boolean autoStartup) 
- 
setPhasepublic void setPhase(int phase) 
- 
isAutoStartuppublic boolean isAutoStartup()- Specified by:
- isAutoStartupin interface- SmartLifecycle
 
- 
getPhasepublic int getPhase()- Specified by:
- getPhasein interface- Phased
- Specified by:
- getPhasein interface- SmartLifecycle
 
- 
isRunning
- 
start
- 
stop
- 
stop- Specified by:
- stopin interface- SmartLifecycle
 
 
-