public interface SockJsService
In a Servlet 3+ container, SockJsHttpRequestHandler
can be used to invoke this
service. The processing servlet, as well as all filters involved, must have
asynchronous support enabled through the ServletContext API or by adding an
<async-support>true</async-support>
element to servlet and filter declarations
in web.xml.
The service can be integrated into any HTTP request handling mechanism (e.g. plain Servlet, Spring MVC, or other). It is expected that it will be mapped, as expected by the SockJS protocol, to a specific prefix (e.g. "/echo") including all sub-URLs (i.e. Ant path pattern "/echo/**").
SockJsHttpRequestHandler
Modifier and Type | Method and Description |
---|---|
void |
handleRequest(org.springframework.http.server.ServerHttpRequest request,
org.springframework.http.server.ServerHttpResponse response,
WebSocketHandler handler)
Process a SockJS HTTP request.
|
void handleRequest(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, WebSocketHandler handler) throws SockJsException
See the "Base URL", "Static URLs", and "Session URLs" sections of the SockJS protocol for details on the types of URLs expected.
request
- the current requestresponse
- the current responsehandler
- the handler that will exchange messages with the SockJS clientSockJsException
- raised when request processing fails; generally, failed
attempts to send messages to clients automatically close the SockJS session
and raise SockJsTransportFailureException
; failed attempts to read
messages from clients do not automatically close the session and may result
in SockJsMessageDeliveryException
or SockJsException
;
exceptions from the WebSocketHandler can be handled internally or through
ExceptionWebSocketHandlerDecorator
or some alternative decorator.
The former is automatically added when using
SockJsHttpRequestHandler
.