org.springframework.web.socket.server.jetty

Class JettyRequestUpgradeStrategy

  • java.lang.Object
    • org.springframework.web.socket.server.jetty.JettyRequestUpgradeStrategy
    • Constructor Summary

      Constructors 
      Constructor and Description
      JettyRequestUpgradeStrategy()
      Default constructor that creates WebSocketServerFactory through its default constructor thus using a default WebSocketPolicy.
      JettyRequestUpgradeStrategy(org.eclipse.jetty.websocket.api.WebSocketPolicy policy)
      A constructor accepting a WebSocketPolicy to be used when creating the WebSocketServerFactory instance.
      JettyRequestUpgradeStrategy(org.eclipse.jetty.websocket.server.WebSocketServerFactory factory)
      A constructor accepting a WebSocketServerFactory.
    • Constructor Detail

      • JettyRequestUpgradeStrategy

        public JettyRequestUpgradeStrategy()
        Default constructor that creates WebSocketServerFactory through its default constructor thus using a default WebSocketPolicy.
      • JettyRequestUpgradeStrategy

        public JettyRequestUpgradeStrategy(org.eclipse.jetty.websocket.api.WebSocketPolicy policy)
        A constructor accepting a WebSocketPolicy to be used when creating the WebSocketServerFactory instance.
        Parameters:
        policy - the policy to use
        Since:
        4.3.5
      • JettyRequestUpgradeStrategy

        public JettyRequestUpgradeStrategy(org.eclipse.jetty.websocket.server.WebSocketServerFactory factory)
        A constructor accepting a WebSocketServerFactory.
        Parameters:
        factory - the pre-configured factory to use
    • Method Detail

      • start

        public void start()
        Description copied from interface: Lifecycle
        Start this component.

        Should not throw an exception if the component is already running.

        In the case of a container, this will propagate the start signal to all components that apply.

        Specified by:
        start in interface Lifecycle
        See Also:
        SmartLifecycle.isAutoStartup()
      • stop

        public void stop()
        Description copied from interface: Lifecycle
        Stop this component, typically in a synchronous fashion, such that the component is fully stopped upon return of this method. Consider implementing SmartLifecycle and its stop(Runnable) variant when asynchronous stop behavior is necessary.

        Note that this stop notification is not guaranteed to come before destruction: On regular shutdown, Lifecycle beans will first receive a stop notification before the general destruction callbacks are being propagated; however, on hot refresh during a context's lifetime or on aborted refresh attempts, a given bean's destroy method will be called without any consideration of stop signals upfront.

        Should not throw an exception if the component is not running (not started yet).

        In the case of a container, this will propagate the stop signal to all components that apply.

        Specified by:
        stop in interface Lifecycle
        See Also:
        SmartLifecycle.stop(Runnable), DisposableBean.destroy()
      • isRunning

        public boolean isRunning()
        Description copied from interface: Lifecycle
        Check whether this component is currently running.

        In the case of a container, this will return true only if all components that apply are currently running.

        Specified by:
        isRunning in interface Lifecycle
        Returns:
        whether the component is currently running
      • upgrade

        public void upgrade(ServerHttpRequest request,
                            ServerHttpResponse response,
                            java.lang.String selectedProtocol,
                            java.util.List<WebSocketExtension> selectedExtensions,
                            java.security.Principal user,
                            WebSocketHandler wsHandler,
                            java.util.Map<java.lang.String,java.lang.Object> attributes)
                     throws HandshakeFailureException
        Description copied from interface: RequestUpgradeStrategy
        Perform runtime specific steps to complete the upgrade. Invoked after successful negotiation of the handshake request.
        Specified by:
        upgrade in interface RequestUpgradeStrategy
        Parameters:
        request - the current request
        response - the current response
        selectedProtocol - the selected sub-protocol, if any
        selectedExtensions - the selected WebSocket protocol extensions
        user - the user to associate with the WebSocket session
        wsHandler - the handler for WebSocket messages
        attributes - handshake request specific attributes to be set on the WebSocket session via HandshakeInterceptor and thus made available to the WebSocketHandler
        Throws:
        HandshakeFailureException - thrown when handshake processing failed to complete due to an internal, unrecoverable error, i.e. a server error as opposed to a failure to successfully negotiate the requirements of the handshake request.