Top Description Methods
org.springframework.web.socket.sockjs

public Interface SockJsService

Known Direct Implementers
org.springframework.web.socket.sockjs.support.AbstractSockJsService
Imports
org.springframework.http.server.ServerHttpRequest, .ServerHttpResponse, org.springframework.lang.Nullable, org.springframework.web.socket.WebSocketHandler, org.springframework.web.socket.handler.ExceptionWebSocketHandlerDecorator

The main entry point for processing HTTP requests from SockJS clients.

In a Servlet 3+ container, org.springframework.web.socket.sockjs.support.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.

Author
Rossen Stoyanchev
Since
4.0
See Also
org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler

Method Summary

Modifier and TypeMethod and Description
public void
handleRequest(ServerHttpRequest
the current request
request
,
ServerHttpResponse
the current response
response
,
String
the remainder of the path within the SockJS service prefix
sockJsPath
,
WebSocketHandler
the handler that will exchange messages with the SockJS client
handler
)

Process a SockJS HTTP request.

Method Detail

handleRequestback to summary
public 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.

Parameters
request:ServerHttpRequest

the current request

response:ServerHttpResponse

the current response

sockJsPath:String

the remainder of the path within the SockJS service prefix

handler:WebSocketHandler

the handler that will exchange messages with the SockJS client

Exceptions
SockJsException:
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 org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler.