org.springframework.web.socket.server.support

## Class WebSocketHttpRequestHandler

- java.lang.Object
- - org.springframework.web.socket.server.support.WebSocketHttpRequestHandler

- All Implemented Interfaces:
    HttpRequestHandler

      public class WebSocketHttpRequestHandler
      extends Object
      implements HttpRequestHandler

  A `HttpRequestHandler` for processing WebSocket handshake requests.

  This is the main class to use when configuring a server WebSocket at a specific URL. It is a very thin wrapper around a `HandshakeHandler` and a `WebSocketHandler` instance also adapting the `HttpServletRequest` and `HttpServletResponse` to `ServerHttpRequest` and `ServerHttpResponse` respectively.

  Since:
    4.0
  Author:
    Rossen Stoyanchev

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `WebSocketHttpRequestHandler(WebSocketHandler webSocketHandler)`
    `WebSocketHttpRequestHandler(WebSocketHandler wsHandler, HandshakeHandler handshakeHandler)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `HandshakeHandler` | `getHandshakeHandler()` Return the HandshakeHandler.
    `List<HandshakeInterceptor>` | `getHandshakeInterceptors()` Return the configured WebSocket handshake request interceptors.
    `WebSocketHandler` | `getWebSocketHandler()` Return the WebSocketHandler.
    `void` | `handleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse)` Process the given request, generating a response.
    `void` | `setHandshakeInterceptors(List<HandshakeInterceptor> interceptors)` Configure one or more WebSocket handshake request interceptors.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### WebSocketHttpRequestHandler

          public WebSocketHttpRequestHandler(WebSocketHandler webSocketHandler)

    - #### WebSocketHttpRequestHandler

          public WebSocketHttpRequestHandler(WebSocketHandler wsHandler,
                                             HandshakeHandler handshakeHandler)

  - ### Method Detail

    - #### getWebSocketHandler

          public WebSocketHandler getWebSocketHandler()

      Return the WebSocketHandler.

    - #### getHandshakeHandler

          public HandshakeHandler getHandshakeHandler()

      Return the HandshakeHandler.

    - #### setHandshakeInterceptors

          public void setHandshakeInterceptors(List<HandshakeInterceptor> interceptors)

      Configure one or more WebSocket handshake request interceptors.

    - #### getHandshakeInterceptors

          public List<HandshakeInterceptor> getHandshakeInterceptors()

      Return the configured WebSocket handshake request interceptors.

    - #### handleRequest

          public void handleRequest(HttpServletRequest servletRequest,
                                    HttpServletResponse servletResponse)
                             throws ServletException,
                                    IOException

      Description copied from interface: `HttpRequestHandler`
      Process the given request, generating a response.
      Specified by:
        `handleRequest` in interface `HttpRequestHandler`
      Parameters:
        `servletRequest` - current HTTP request
        `servletResponse` - current HTTP response
      Throws:
        `ServletException` - in case of general errors
        `IOException` - in case of I/O errors