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
public class XhrPollingTransportHandler extends AbstractHttpSendingTransportHandler
ATransportHandler
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 Constructor Description XhrPollingTransportHandler()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkSessionType(SockJsSession session)
Check whether the type of the given session matches the transport type of thisTransportHandler
where session id and the transport type are extracted from the SockJS URL.PollingSockJsSession
createSession(String sessionId, WebSocketHandler handler, Map<String,Object> attributes)
Create a new SockJS session.protected MediaType
getContentType()
protected SockJsFrameFormat
getFrameFormat(ServerHttpRequest request)
TransportType
getTransportType()
Return the transport type supported by this handler.Methods inherited from class org.springframework.web.socket.sockjs.transport.handler.AbstractHttpSendingTransportHandler
getCallbackParam, handleRequest, handleRequestInternal
Methods inherited from class org.springframework.web.socket.sockjs.transport.handler.AbstractTransportHandler
getServiceConfig, initialize
Constructor Detail
XhrPollingTransportHandler
public XhrPollingTransportHandler()
Method Detail
getTransportType
public TransportType getTransportType()
Description copied from interface:TransportHandler
Return the transport type supported by this handler.
getContentType
protected MediaType getContentType()
- Specified by:
getContentType
in classAbstractHttpSendingTransportHandler
getFrameFormat
protected SockJsFrameFormat getFrameFormat(ServerHttpRequest request)
- Specified by:
getFrameFormat
in classAbstractHttpSendingTransportHandler
checkSessionType
public boolean checkSessionType(SockJsSession session)
Description copied from interface:TransportHandler
Check whether the type of the given session matches the transport type of thisTransportHandler
where session id and the transport type are extracted from the SockJS URL.- Returns:
true
if 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)
), orfalse
otherwise
createSession
public PollingSockJsSession createSession(String sessionId, WebSocketHandler handler, Map<String,Object> attributes)
Description copied from interface:SockJsSessionFactory
Create a new SockJS session.- Parameters:
sessionId
- the ID of the sessionhandler
- the underlyingWebSocketHandler
attributes
- handshake request specific attributes- Returns:
- a new session, never
null