Class HtmlFileTransportHandler
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.HtmlFileTransportHandler
- All Implemented Interfaces:
SockJsSessionFactory
,TransportHandler
An HTTP
TransportHandler
that uses a famous browser
document.domain
technique. See
stackoverflow.com/questions/1481251/what-does-document-domain-document-domain-do
for details.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
-
Field Summary
Fields inherited from class org.springframework.web.socket.sockjs.transport.handler.AbstractTransportHandler
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
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.createSession
(String sessionId, WebSocketHandler handler, Map<String, Object> attributes) Create a new SockJS session.protected MediaType
protected SockJsFrameFormat
getFrameFormat
(ServerHttpRequest request) Return the transport type supported by this handler.void
handleRequestInternal
(ServerHttpRequest request, ServerHttpResponse response, AbstractHttpSockJsSession sockJsSession) Methods inherited from class org.springframework.web.socket.sockjs.transport.handler.AbstractHttpSendingTransportHandler
getCallbackParam, handleRequest
Methods inherited from class org.springframework.web.socket.sockjs.transport.handler.AbstractTransportHandler
getServiceConfig, initialize
-
Constructor Details
-
HtmlFileTransportHandler
public HtmlFileTransportHandler()
-
-
Method Details
-
getTransportType
Description copied from interface:TransportHandler
Return the transport type supported by this handler. -
getContentType
- Specified by:
getContentType
in classAbstractHttpSendingTransportHandler
-
checkSessionType
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 StreamingSockJsSession 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
-
handleRequestInternal
public void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response, AbstractHttpSockJsSession sockJsSession) throws SockJsException - Overrides:
handleRequestInternal
in classAbstractHttpSendingTransportHandler
- Throws:
SockJsException
-
getFrameFormat
- Specified by:
getFrameFormat
in classAbstractHttpSendingTransportHandler
-