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
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.voidhandleRequestInternal(ServerHttpRequest request, ServerHttpResponse response, AbstractHttpSockJsSession sockJsSession) Methods inherited from class org.springframework.web.socket.sockjs.transport.handler.AbstractHttpSendingTransportHandler
getCallbackParam, handleRequestMethods 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:TransportHandlerReturn the transport type supported by this handler. -
getContentType
- Specified by:
getContentTypein 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 StreamingSockJsSession 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
-
handleRequestInternal
public void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response, AbstractHttpSockJsSession sockJsSession) throws SockJsException - Overrides:
handleRequestInternalin classAbstractHttpSendingTransportHandler- Throws:
SockJsException
-
getFrameFormat
- Specified by:
getFrameFormatin classAbstractHttpSendingTransportHandler
-