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

public Class HtmlFileTransportHandler

extends AbstractHttpSendingTransportHandler
Class Inheritance
Imports
java.io.IOException, java.nio.charset.StandardCharsets, java.util.Map, org.springframework.http.HttpStatus, .MediaType, org.springframework.http.server.ServerHttpRequest, .ServerHttpResponse, org.springframework.util.StringUtils, org.springframework.web.socket.CloseStatus, .WebSocketHandler, org.springframework.web.socket.sockjs.SockJsException, .SockJsTransportFailureException, org.springframework.web.socket.sockjs.frame.DefaultSockJsFrameFormat, .SockJsFrameFormat, org.springframework.web.socket.sockjs.transport.SockJsServiceConfig, .SockJsSession, .TransportHandler, .TransportType, org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession, .StreamingSockJsSession, org.springframework.web.util.JavaScriptUtils

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.
Author
Rossen Stoyanchev
Since
4.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private static final int
private static final String

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 StreamingSockJsSession
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.

public void
Inherited from org.springframework.web.socket.sockjs.transport.handler.AbstractHttpSendingTransportHandler:
getCallbackParamhandleRequest

Field Detail

MINIMUM_PARTIAL_HTML_CONTENT_LENGTHback to summary
private static final int MINIMUM_PARTIAL_HTML_CONTENT_LENGTH
PARTIAL_HTML_CONTENTback to summary
private static final String PARTIAL_HTML_CONTENT

Constructor Detail

HtmlFileTransportHandlerback to summary
public HtmlFileTransportHandler()

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 StreamingSockJsSession 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:StreamingSockJsSession

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
handleRequestInternalback to summary
public void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response, AbstractHttpSockJsSession sockJsSession) throws SockJsException

Overrides org.springframework.web.socket.sockjs.transport.handler.AbstractHttpSendingTransportHandler.handleRequestInternal.

Annotations
@Override
org.springframework.web.socket.sockjs.transport.handler back to summary

private Class HtmlFileTransportHandler.HtmlFileStreamingSockJsSession

extends StreamingSockJsSession
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected byte[]
getPrelude(ServerHttpRequest request)

Implements abstract org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession.getPrelude.

Get the prelude to write to the response before any other data.

Inherited from org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession:
flushCachehandleRequestInternal

Constructor Detail

HtmlFileStreamingSockJsSessionback to summary
public HtmlFileStreamingSockJsSession(String sessionId, SockJsServiceConfig config, WebSocketHandler wsHandler, Map<String, Object> attributes)

Method Detail

getPreludeback to summary
protected byte[] getPrelude(ServerHttpRequest request)

Implements abstract org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession.getPrelude.

Doc from org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession.getPrelude.

Get the prelude to write to the response before any other data.

Annotations
@Override