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
ConstructorDescriptionSockJsHttpRequestHandler
(SockJsService sockJsService, WebSocketHandler webSocketHandler) Create a new SockJsHttpRequestHandler. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.web.cors.CorsConfiguration
getCorsConfiguration
(HttpServletRequest request) Return theSockJsService
.Return theWebSocketHandler
.void
handleRequest
(HttpServletRequest servletRequest, HttpServletResponse servletResponse) boolean
void
setServletContext
(ServletContext servletContext) void
start()
void
stop()
-
Constructor Details
-
SockJsHttpRequestHandler
Create a new SockJsHttpRequestHandler.- Parameters:
sockJsService
- the SockJS servicewebSocketHandler
- the websocket handler
-
-
Method Details
-
getSockJsService
Return theSockJsService
. -
getWebSocketHandler
Return theWebSocketHandler
. -
setServletContext
- Specified by:
setServletContext
in interfaceorg.springframework.web.context.ServletContextAware
-
start
public void start()- Specified by:
start
in interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stop
in interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunning
in interfaceorg.springframework.context.Lifecycle
-
handleRequest
public void handleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException - Specified by:
handleRequest
in interfaceorg.springframework.web.HttpRequestHandler
- Throws:
ServletException
IOException
-
getCorsConfiguration
@Nullable public org.springframework.web.cors.CorsConfiguration getCorsConfiguration(HttpServletRequest request) - Specified by:
getCorsConfiguration
in interfaceorg.springframework.web.cors.CorsConfigurationSource
-