public class WebSocketHttpRequestHandler extends java.lang.Object implements HttpRequestHandler
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 HandshakeHandler
and a
WebSocketHandler
instance also adapting the HttpServletRequest
and
HttpServletResponse
to ServerHttpRequest
and ServerHttpResponse
respectively.
Modifier and Type | Field and Description |
---|---|
private HandshakeHandler |
handshakeHandler |
private java.util.List<HandshakeInterceptor> |
interceptors |
private WebSocketHandler |
wsHandler |
Constructor and Description |
---|
WebSocketHttpRequestHandler(WebSocketHandler webSocketHandler) |
WebSocketHttpRequestHandler(WebSocketHandler wsHandler,
HandshakeHandler handshakeHandler) |
Modifier and Type | Method and Description |
---|---|
HandshakeHandler |
getHandshakeHandler()
Return the HandshakeHandler.
|
java.util.List<HandshakeInterceptor> |
getHandshakeInterceptors()
Return the configured WebSocket handshake request interceptors.
|
WebSocketHandler |
getWebSocketHandler()
Return the WebSocketHandler.
|
void |
handleRequest(HttpServletRequest servletRequest,
HttpServletResponse servletResponse)
Process the given request, generating a response.
|
void |
setHandshakeInterceptors(java.util.List<HandshakeInterceptor> interceptors)
Configure one or more WebSocket handshake request interceptors.
|
private final HandshakeHandler handshakeHandler
private final WebSocketHandler wsHandler
private final java.util.List<HandshakeInterceptor> interceptors
public WebSocketHttpRequestHandler(WebSocketHandler webSocketHandler)
public WebSocketHttpRequestHandler(WebSocketHandler wsHandler, HandshakeHandler handshakeHandler)
public WebSocketHandler getWebSocketHandler()
public HandshakeHandler getHandshakeHandler()
public void setHandshakeInterceptors(java.util.List<HandshakeInterceptor> interceptors)
public java.util.List<HandshakeInterceptor> getHandshakeInterceptors()
public void handleRequest(HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws ServletException, java.io.IOException
HttpRequestHandler
handleRequest
in interface HttpRequestHandler
servletRequest
- current HTTP requestservletResponse
- current HTTP responseServletException
- in case of general errorsjava.io.IOException
- in case of I/O errors