Class JettyRequestUpgradeStrategy

java.lang.Object
org.springframework.web.socket.server.jetty.JettyRequestUpgradeStrategy
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.web.context.ServletContextAware, RequestUpgradeStrategy

public class JettyRequestUpgradeStrategy extends Object implements RequestUpgradeStrategy, org.springframework.web.context.ServletContextAware
A RequestUpgradeStrategy for Jetty 11.
Since:
5.3.4
Author:
Rossen Stoyanchev
  • Constructor Details

    • JettyRequestUpgradeStrategy

      public JettyRequestUpgradeStrategy()
  • Method Details

    • getSupportedVersions

      public String[] getSupportedVersions()
      Description copied from interface: RequestUpgradeStrategy
      Return the supported WebSocket protocol versions.
      Specified by:
      getSupportedVersions in interface RequestUpgradeStrategy
    • getSupportedExtensions

      public List<WebSocketExtension> getSupportedExtensions(org.springframework.http.server.ServerHttpRequest request)
      Description copied from interface: RequestUpgradeStrategy
      Return the WebSocket protocol extensions supported by the underlying WebSocket server.
      Specified by:
      getSupportedExtensions in interface RequestUpgradeStrategy
    • addWebSocketConfigurer

      public void addWebSocketConfigurer(Consumer<org.eclipse.jetty.websocket.api.Configurable> webSocketConfigurer)
      Add a callback to configure WebSocket server parameters on JettyWebSocketServerContainer.
      Since:
      6.1
    • setServletContext

      public void setServletContext(ServletContext servletContext)
      Specified by:
      setServletContext in interface org.springframework.web.context.ServletContextAware
    • upgrade

      public void upgrade(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, @Nullable String selectedProtocol, List<WebSocketExtension> selectedExtensions, @Nullable Principal user, WebSocketHandler handler, Map<String,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
      handler - 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.