public class WebSocketHttpRequestHandler extends Object implements org.springframework.web.HttpRequestHandler, org.springframework.context.Lifecycle, org.springframework.web.context.ServletContextAware
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 WebSocketHandler
and a HandshakeHandler
,
also adapting the HttpServletRequest
and HttpServletResponse
to
ServerHttpRequest
and ServerHttpResponse
, respectively.
Constructor and Description |
---|
WebSocketHttpRequestHandler(WebSocketHandler wsHandler) |
WebSocketHttpRequestHandler(WebSocketHandler wsHandler,
HandshakeHandler handshakeHandler) |
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) |
boolean |
isRunning() |
void |
setHandshakeInterceptors(List<HandshakeInterceptor> interceptors)
Configure one or more WebSocket handshake request interceptors.
|
void |
setServletContext(ServletContext servletContext) |
void |
start() |
void |
stop() |
public WebSocketHttpRequestHandler(WebSocketHandler wsHandler)
public WebSocketHttpRequestHandler(WebSocketHandler wsHandler, HandshakeHandler handshakeHandler)
public WebSocketHandler getWebSocketHandler()
public HandshakeHandler getHandshakeHandler()
public void setHandshakeInterceptors(List<HandshakeInterceptor> interceptors)
public List<HandshakeInterceptor> getHandshakeInterceptors()
public void setServletContext(ServletContext servletContext)
setServletContext
in interface org.springframework.web.context.ServletContextAware
public boolean isRunning()
isRunning
in interface org.springframework.context.Lifecycle
public void start()
start
in interface org.springframework.context.Lifecycle
public void stop()
stop
in interface org.springframework.context.Lifecycle
public void handleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, IOException
handleRequest
in interface org.springframework.web.HttpRequestHandler
ServletException
IOException