public class SockJsHttpRequestHandler extends java.lang.Object implements HttpRequestHandler
HttpRequestHandler
for processing SockJS requests. This is the main class
to use when configuring a SockJS service at a specific URL. It is a very thin wrapper
around a SockJsService
and a WebSocketHandler
instance also adapting
the HttpServletRequest
and HttpServletResponse
to
ServerHttpRequest
and ServerHttpResponse
respectively.
The decorateWebSocketHandler(WebSocketHandler)
method decorates the given
WebSocketHandler with a logging and exception handling decorators. This method can be
overridden to change that.
Modifier and Type | Field and Description |
---|---|
private SockJsService |
sockJsService |
private WebSocketHandler |
webSocketHandler |
Constructor and Description |
---|
SockJsHttpRequestHandler(SockJsService sockJsService,
WebSocketHandler webSocketHandler)
Create a new
SockJsHttpRequestHandler . |
Modifier and Type | Method and Description |
---|---|
protected WebSocketHandler |
decorateWebSocketHandler(WebSocketHandler handler)
Decorate the WebSocketHandler provided to the class constructor.
|
void |
handleRequest(HttpServletRequest request,
HttpServletResponse response)
Process the given request, generating a response.
|
private final SockJsService sockJsService
private final WebSocketHandler webSocketHandler
public SockJsHttpRequestHandler(SockJsService sockJsService, WebSocketHandler webSocketHandler)
SockJsHttpRequestHandler
.sockJsService
- the SockJS servicewebSocketHandler
- the websocket handlerprotected WebSocketHandler decorateWebSocketHandler(WebSocketHandler handler)
By default ExceptionWebSocketHandlerDecorator
and
LoggingWebSocketHandlerDecorator
are applied are added.
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, java.io.IOException
HttpRequestHandler
handleRequest
in interface HttpRequestHandler
request
- current HTTP requestresponse
- current HTTP responseServletException
- in case of general errorsjava.io.IOException
- in case of I/O errors