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

public abstract Class AbstractHttpSendingTransportHandler

extends AbstractTransportHandler
implements SockJsSessionFactory
Class Inheritance
All Implemented Interfaces
org.springframework.web.socket.sockjs.transport.SockJsSessionFactory
Known Direct Subclasses
org.springframework.web.socket.sockjs.transport.handler.EventSourceTransportHandler, org.springframework.web.socket.sockjs.transport.handler.HtmlFileTransportHandler, org.springframework.web.socket.sockjs.transport.handler.XhrPollingTransportHandler, org.springframework.web.socket.sockjs.transport.handler.XhrStreamingTransportHandler
Imports
java.io.IOException, java.nio.charset.StandardCharsets, java.util.regex.Pattern, org.springframework.http.MediaType, org.springframework.http.server.ServerHttpRequest, .ServerHttpResponse, org.springframework.lang.Nullable, org.springframework.util.MultiValueMap, .StringUtils, org.springframework.web.socket.WebSocketHandler, org.springframework.web.socket.sockjs.SockJsException, org.springframework.web.socket.sockjs.frame.SockJsFrame, .SockJsFrameFormat, org.springframework.web.socket.sockjs.transport.SockJsSession, .SockJsSessionFactory, org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession, org.springframework.web.util.UriComponentsBuilder, .UriUtils

Base class for HTTP transport handlers that push messages to connected clients.
Author
Rossen Stoyanchev
Since
4.0

Field Summary

Modifier and TypeField and Description
private static final Pattern
CALLBACK_PARAM_PATTERN

Pattern for validating callback parameter values.

Inherited from org.springframework.web.socket.sockjs.transport.handler.AbstractTransportHandler:
logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected final String
protected abstract MediaType
protected abstract SockJsFrameFormat
public final void
handleRequest(ServerHttpRequest
the current request
request
,
ServerHttpResponse
the current response
response
,
WebSocketHandler
the target WebSocketHandler (never null)
wsHandler
,
SockJsSession
the SockJS session (never null)
wsSession
)

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

Handle the given request and delegate messages to the provided WebSocketHandler.

protected void
private void
Inherited from org.springframework.web.socket.sockjs.transport.handler.AbstractTransportHandler:
getServiceConfiginitialize

Field Detail

CALLBACK_PARAM_PATTERNback to summary
private static final Pattern CALLBACK_PARAM_PATTERN

Pattern for validating callback parameter values.

Constructor Detail

AbstractHttpSendingTransportHandlerback to summary
public AbstractHttpSendingTransportHandler()

Method Detail

getCallbackParamback to summary
protected final String getCallbackParam(ServerHttpRequest request)
Annotations
@Nullable
getContentTypeback to summary
protected abstract MediaType getContentType()
getFrameFormatback to summary
protected abstract SockJsFrameFormat getFrameFormat(ServerHttpRequest request)
handleRequestback to summary
public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, SockJsSession wsSession) throws SockJsException

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

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

Handle the given request and delegate messages to the provided WebSocketHandler.

Parameters
request:ServerHttpRequest

the current request

response:ServerHttpResponse

the current response

wsHandler:WebSocketHandler

the target WebSocketHandler (never null)

wsSession:SockJsSession

the SockJS session (never null)

Annotations
@Override
Exceptions
SockJsException:
raised when request processing fails as explained in SockJsService
handleRequestInternalback to summary
protected void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response, AbstractHttpSockJsSession sockJsSession) throws SockJsException
writeFrameback to summary
private void writeFrame(SockJsFrame frame, ServerHttpRequest request, ServerHttpResponse response, AbstractHttpSockJsSession sockJsSession)