org.springframework.web.socket.server

## Interface RequestUpgradeStrategy

- All Known Implementing Classes:
    AbstractStandardUpgradeStrategy, GlassFishRequestUpgradeStrategy, JettyRequestUpgradeStrategy, TomcatRequestUpgradeStrategy, UndertowRequestUpgradeStrategy

      public interface RequestUpgradeStrategy

  A server-specific strategy for performing the actual upgrade to a WebSocket exchange.
  Since:
    4.0
  Author:
    Rossen Stoyanchev

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<WebSocketExtension>` | `getSupportedExtensions(ServerHttpRequest request)`
    `String[]` | `getSupportedVersions()` Return the supported WebSocket protocol versions.
    `void` | `upgrade(ServerHttpRequest request, ServerHttpResponse response, String selectedProtocol, List<WebSocketExtension> selectedExtensions, Principal user, WebSocketHandler wsHandler, Map<String,Object> attributes)` Perform runtime specific steps to complete the upgrade.

- - ### Method Detail

    - #### getSupportedVersions

          String[] getSupportedVersions()

      Return the supported WebSocket protocol versions.

    - #### getSupportedExtensions

          List<WebSocketExtension> getSupportedExtensions(ServerHttpRequest request)

      Returns:
        the WebSocket protocol extensions supported by the underlying WebSocket server.

    - #### upgrade

          void upgrade(ServerHttpRequest request,
                       ServerHttpResponse response,
                       String selectedProtocol,
                       List<WebSocketExtension> selectedExtensions,
                       Principal user,
                       WebSocketHandler wsHandler,
                       Map<String,Object> attributes)
                throws HandshakeFailureException

      Perform runtime specific steps to complete the upgrade. Invoked after successful negotiation of the handshake request.
      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.