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

public abstract Class AbstractHttpReceivingTransportHandler

extends AbstractTransportHandler
Class Inheritance
Known Direct Subclasses
org.springframework.web.socket.sockjs.transport.handler.XhrReceivingTransportHandler
Imports
java.io.IOException, java.nio.charset.StandardCharsets, java.util.Arrays, org.springframework.http.HttpStatus, .HttpStatusCode, .MediaType, org.springframework.http.server.ServerHttpRequest, .ServerHttpResponse, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.web.socket.WebSocketHandler, org.springframework.web.socket.sockjs.SockJsException, org.springframework.web.socket.sockjs.transport.SockJsSession, org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession

Base class for HTTP transport handlers that receive messages via HTTP POST.
Author
Rossen Stoyanchev
Since
4.0

Field Summary

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

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.

protected abstract HttpStatusCode
private void
handleReadError(ServerHttpResponse response, String error, String sessionId)

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
protected abstract String[]
Inherited from org.springframework.web.socket.sockjs.transport.handler.AbstractTransportHandler:
getServiceConfiginitialize

Constructor Detail

AbstractHttpReceivingTransportHandlerback to summary
public AbstractHttpReceivingTransportHandler()

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
getResponseStatusback to summary
protected abstract HttpStatusCode getResponseStatus()
handleReadErrorback to summary
private void handleReadError(ServerHttpResponse response, String error, String sessionId)
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, WebSocketHandler wsHandler, AbstractHttpSockJsSession sockJsSession) throws SockJsException
readMessagesback to summary
protected abstract String[] readMessages(ServerHttpRequest request) throws IOException
Annotations
@Nullable