Top Description Constructors Methods
org.springframework.web.socket.sockjs.transport.handler

public Class XhrPollingTransportHandler

extends AbstractHttpSendingTransportHandler
Class Inheritance
Imports
java.nio.charset.StandardCharsets, java.util.Map, org.springframework.http.MediaType, org.springframework.http.server.ServerHttpRequest, org.springframework.web.socket.WebSocketHandler, org.springframework.web.socket.sockjs.frame.DefaultSockJsFrameFormat, .SockJsFrameFormat, org.springframework.web.socket.sockjs.transport.SockJsSession, .TransportHandler, .TransportType, org.springframework.web.socket.sockjs.transport.session.PollingSockJsSession

A TransportHandler based on XHR (long) polling.
Author
Rossen Stoyanchev
Since
4.0

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
checkSessionType(SockJsSession session)

Implements org.springframework.web.socket.sockjs.transport.TransportHandler.checkSessionType.

Check whether the type of the given session matches the transport type of this TransportHandler where session id and the transport type are extracted from the SockJS URL.

public PollingSockJsSession
createSession(String
the ID of the session
sessionId
,
WebSocketHandler
the underlying WebSocketHandler
handler
,
Map<String, Object>
handshake request specific attributes
attributes
)

Implements org.springframework.web.socket.sockjs.transport.SockJsSessionFactory.createSession.

Create a new SockJS session.

protected MediaType
protected SockJsFrameFormat
public TransportType
getTransportType()

Implements org.springframework.web.socket.sockjs.transport.TransportHandler.getTransportType.

Return the transport type supported by this handler.

Inherited from org.springframework.web.socket.sockjs.transport.handler.AbstractHttpSendingTransportHandler:
getCallbackParamhandleRequesthandleRequestInternal

Constructor Detail

XhrPollingTransportHandlerback to summary
public XhrPollingTransportHandler()

Method Detail

checkSessionTypeback to summary
public boolean checkSessionType(SockJsSession session)

Implements org.springframework.web.socket.sockjs.transport.TransportHandler.checkSessionType.

Doc from org.springframework.web.socket.sockjs.transport.TransportHandler.checkSessionType.

Check whether the type of the given session matches the transport type of this TransportHandler where session id and the transport type are extracted from the SockJS URL.

Returns:boolean

true if the session matches (and would therefore get accepted by handleRequest), or false otherwise

Annotations
@Override
createSessionback to summary
public PollingSockJsSession createSession(String sessionId, WebSocketHandler handler, Map<String, Object> attributes)

Implements org.springframework.web.socket.sockjs.transport.SockJsSessionFactory.createSession.

Doc from org.springframework.web.socket.sockjs.transport.SockJsSessionFactory.createSession.

Create a new SockJS session.

Parameters
sessionId:String

the ID of the session

handler:WebSocketHandler

the underlying WebSocketHandler

attributes:Map<String, Object>

handshake request specific attributes

Returns:PollingSockJsSession

a new session, never null

Annotations
@Override
getContentTypeback to summary
protected MediaType getContentType()

Implements abstract org.springframework.web.socket.sockjs.transport.handler.AbstractHttpSendingTransportHandler.getContentType.

Annotations
@Override
getFrameFormatback to summary
protected SockJsFrameFormat getFrameFormat(ServerHttpRequest request)

Implements abstract org.springframework.web.socket.sockjs.transport.handler.AbstractHttpSendingTransportHandler.getFrameFormat.

Annotations
@Override
getTransportTypeback to summary
public TransportType getTransportType()

Implements org.springframework.web.socket.sockjs.transport.TransportHandler.getTransportType.

Doc from org.springframework.web.socket.sockjs.transport.TransportHandler.getTransportType.

Return the transport type supported by this handler.

Annotations
@Override