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
ConstructorsConstructorDescriptionSockJsHttpRequestHandler(SockJsService sockJsService, WebSocketHandler webSocketHandler) Create a new SockJsHttpRequestHandler. -
Method Summary
Modifier and TypeMethodDescription@Nullable org.springframework.web.cors.CorsConfigurationgetCorsConfiguration(HttpServletRequest request) Return theSockJsService.Return theWebSocketHandler.voidhandleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse) booleanvoidsetServletContext(ServletContext servletContext) voidstart()voidstop()
-
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:
setServletContextin interfaceorg.springframework.web.context.ServletContextAware
-
start
public void start()- Specified by:
startin interfaceorg.springframework.context.Lifecycle
-
stop
public void stop()- Specified by:
stopin interfaceorg.springframework.context.Lifecycle
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceorg.springframework.context.Lifecycle
-
handleRequest
public void handleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException - Specified by:
handleRequestin interfaceorg.springframework.web.HttpRequestHandler- Throws:
ServletExceptionIOException
-
getCorsConfiguration
public @Nullable org.springframework.web.cors.CorsConfiguration getCorsConfiguration(HttpServletRequest request) - Specified by:
getCorsConfigurationin interfaceorg.springframework.web.cors.CorsConfigurationSource
-