接口 SockJsService
public interface SockJsService
The main entry point for processing HTTP requests from SockJS clients.In a Servlet 3+ container,
SockJsHttpRequestHandlercan 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.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
- 另请参阅:
SockJsHttpRequestHandler
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 voidhandleRequest(ServerHttpRequest request, ServerHttpResponse response, String sockJsPath, WebSocketHandler handler)Process a SockJS HTTP request.
方法详细资料
handleRequest
void handleRequest(ServerHttpRequest request, ServerHttpResponse response, String sockJsPath, WebSocketHandler handler) throws SockJsException
Process a SockJS HTTP request.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 responsesockJsPath- the remainder of the path within the SockJS service prefixhandler- the handler that will exchange messages with the SockJS client- 抛出:
SockJsException- raised when request processing fails; generally, failed attempts to send messages to clients automatically close the SockJS session and raiseSockJsTransportFailureException; failed attempts to read messages from clients do not automatically close the session and may result inSockJsMessageDeliveryExceptionorSockJsException; exceptions from the WebSocketHandler can be handled internally or throughExceptionWebSocketHandlerDecoratoror some alternative decorator. The former is automatically added when usingSockJsHttpRequestHandler.