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 Details

    • SockJsHttpRequestHandler

      public SockJsHttpRequestHandler(SockJsService sockJsService, WebSocketHandler webSocketHandler)
      Create a new SockJsHttpRequestHandler.
      Parameters:
      sockJsService - the SockJS service
      webSocketHandler - the websocket handler
  • Method Details

    • 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