org.springframework.web.socket.sockjs.support

## Class SockJsHttpRequestHandler

- java.lang.Object
- - org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler

All Implemented Interfaces:
  org.springframework.beans.factory.Aware, org.springframework.context.Lifecycle, org.springframework.web.context.ServletContextAware, org.springframework.web.cors.CorsConfigurationSource, org.springframework.web.HttpRequestHandler

    public class SockJsHttpRequestHandler
    extends Object
    implements org.springframework.web.HttpRequestHandler, org.springframework.web.cors.CorsConfigurationSource, org.springframework.context.Lifecycle, org.springframework.web.context.ServletContextAware

An `HttpRequestHandler` that allows mapping a `SockJsService` to requests in a Servlet container.

Since:
  4.0
Author:
  Rossen Stoyanchev, Sebastien Deleuze

### Constructor Summary

Constructors
Constructor and Description
`SockJsHttpRequestHandler(SockJsService sockJsService, WebSocketHandler webSocketHandler)` Create a new SockJsHttpRequestHandler.

### Method Summary

All Methods Instance Methods Concrete Methods
`org.springframework.web.cors.CorsConfiguration` `getCorsConfiguration(HttpServletRequest request)`
`SockJsService` `getSockJsService()` Return the `SockJsService`.
`WebSocketHandler` `getWebSocketHandler()` Return the `WebSocketHandler`.
`void` `handleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse)`
`boolean` `isRunning()`
`void` `setServletContext(ServletContext servletContext)`
`void` `start()`
`void` `stop()`

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

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

### Constructor Detail

#### SockJsHttpRequestHandler

    public SockJsHttpRequestHandler(SockJsService sockJsService,
                                    WebSocketHandler webSocketHandler)

Create a new SockJsHttpRequestHandler.

Parameters:
  `sockJsService` - the SockJS service
  `webSocketHandler` - the websocket handler

### Method Detail

#### getSockJsService

    public SockJsService getSockJsService()

Return the `SockJsService`.

#### getWebSocketHandler

    public WebSocketHandler getWebSocketHandler()

Return the `WebSocketHandler`.

#### setServletContext

    public void setServletContext(ServletContext servletContext)

Specified by:
  `setServletContext` in interface `org.springframework.web.context.ServletContextAware`

#### 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`

#### isRunning

    public boolean isRunning()

Specified by:
  `isRunning` in interface `org.springframework.context.Lifecycle`

#### handleRequest

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

Specified by:
  `handleRequest` in interface `org.springframework.web.HttpRequestHandler`
Throws:
  `ServletException`
  `IOException`

#### getCorsConfiguration

    @Nullable
    public org.springframework.web.cors.CorsConfiguration getCorsConfiguration(HttpServletRequest request)

Specified by:
  `getCorsConfiguration` in interface `org.springframework.web.cors.CorsConfigurationSource`