Class ServerWebSocketContainer

java.lang.Object
org.springframework.integration.websocket.IntegrationWebSocketContainer
org.springframework.integration.websocket.ServerWebSocketContainer
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, org.springframework.web.socket.config.annotation.WebSocketConfigurer

public class ServerWebSocketContainer
extends IntegrationWebSocketContainer
implements org.springframework.web.socket.config.annotation.WebSocketConfigurer, org.springframework.context.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
  • Constructor Details

  • Method Details

    • setHandshakeHandler

      public ServerWebSocketContainer setHandshakeHandler​(org.springframework.web.socket.server.HandshakeHandler handshakeHandler)
    • setInterceptors

      public ServerWebSocketContainer setInterceptors​(org.springframework.web.socket.server.HandshakeInterceptor... interceptors)
    • setDecoratorFactories

      public ServerWebSocketContainer setDecoratorFactories​(org.springframework.web.socket.handler.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
    • setAllowedOrigins

      public ServerWebSocketContainer setAllowedOrigins​(java.lang.String... origins)
      Configure allowed Origin header values.
      Parameters:
      origins - the origins to allow.
      Returns:
      the current ServerWebSocketContainer
      Since:
      4.3
      See Also:
      WebSocketHandlerRegistration.setAllowedOrigins(String...)
    • withSockJs

      public ServerWebSocketContainer withSockJs​(ServerWebSocketContainer.SockJsServiceOptions... sockJsServiceOptions)
    • setSockJsServiceOptions

      public void setSockJsServiceOptions​(ServerWebSocketContainer.SockJsServiceOptions sockJsServiceOptions)
    • registerWebSocketHandlers

      public void registerWebSocketHandlers​(org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry registry)
      Specified by:
      registerWebSocketHandlers in interface org.springframework.web.socket.config.annotation.WebSocketConfigurer
    • setAutoStartup

      public void setAutoStartup​(boolean autoStartup)
    • setPhase

      public void setPhase​(int phase)
    • isAutoStartup

      public boolean isAutoStartup()
      Specified by:
      isAutoStartup in interface org.springframework.context.SmartLifecycle
    • getPhase

      public int getPhase()
      Specified by:
      getPhase in interface org.springframework.context.Phased
      Specified by:
      getPhase in interface org.springframework.context.SmartLifecycle
    • isRunning

      public boolean isRunning()
      Specified by:
      isRunning in interface org.springframework.context.Lifecycle
    • start

      public void start()
      Specified by:
      start in interface org.springframework.context.Lifecycle
    • stop

      public void stop()
      Specified by:
      stop in interface org.springframework.context.Lifecycle
    • stop

      public void stop​(java.lang.Runnable callback)
      Specified by:
      stop in interface org.springframework.context.SmartLifecycle