Class XhrPollingTransportHandler
java.lang.Object
org.springframework.web.socket.sockjs.transport.handler.AbstractTransportHandler
org.springframework.web.socket.sockjs.transport.handler.AbstractHttpSendingTransportHandler
org.springframework.web.socket.sockjs.transport.handler.XhrPollingTransportHandler
- All Implemented Interfaces:
SockJsSessionFactory,TransportHandler
A
TransportHandler based on XHR (long) polling.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
-
Field Summary
Fields inherited from class org.springframework.web.socket.sockjs.transport.handler.AbstractTransportHandler
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckSessionType(SockJsSession session) Check whether the type of the given session matches the transport type of thisTransportHandlerwhere session id and the transport type are extracted from the SockJS URL.createSession(String sessionId, WebSocketHandler handler, Map<String, Object> attributes) Create a new SockJS session.protected MediaTypeprotected SockJsFrameFormatgetFrameFormat(ServerHttpRequest request) Return the transport type supported by this handler.Methods inherited from class org.springframework.web.socket.sockjs.transport.handler.AbstractHttpSendingTransportHandler
getCallbackParam, handleRequest, handleRequestInternalMethods inherited from class org.springframework.web.socket.sockjs.transport.handler.AbstractTransportHandler
getServiceConfig, initialize
-
Constructor Details
-
XhrPollingTransportHandler
public XhrPollingTransportHandler()
-
-
Method Details
-
getTransportType
Description copied from interface:TransportHandlerReturn the transport type supported by this handler. -
getContentType
- Specified by:
getContentTypein classAbstractHttpSendingTransportHandler
-
getFrameFormat
- Specified by:
getFrameFormatin classAbstractHttpSendingTransportHandler
-
checkSessionType
Description copied from interface:TransportHandlerCheck whether the type of the given session matches the transport type of thisTransportHandlerwhere session id and the transport type are extracted from the SockJS URL.- Returns:
trueif the session matches (and would therefore get accepted byTransportHandler.handleRequest(org.springframework.http.server.ServerHttpRequest, org.springframework.http.server.ServerHttpResponse, org.springframework.web.socket.WebSocketHandler, org.springframework.web.socket.sockjs.transport.SockJsSession)), orfalseotherwise
-
createSession
public PollingSockJsSession createSession(String sessionId, WebSocketHandler handler, Map<String, Object> attributes) Description copied from interface:SockJsSessionFactoryCreate a new SockJS session.- Parameters:
sessionId- the ID of the sessionhandler- the underlyingWebSocketHandlerattributes- handshake request specific attributes- Returns:
- a new session, never
null
-