Class AbstractHttpReceivingTransportHandler
java.lang.Object
org.springframework.web.socket.sockjs.transport.handler.AbstractTransportHandler
org.springframework.web.socket.sockjs.transport.handler.AbstractHttpReceivingTransportHandler
- All Implemented Interfaces:
TransportHandler
- Direct Known Subclasses:
XhrReceivingTransportHandler
Base class for HTTP transport handlers that receive messages via HTTP POST.
- 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.protected abstract HttpStatusCode
final void
handleRequest
(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, SockJsSession wsSession) Handle the given request and delegate messages to the providedWebSocketHandler
.protected void
handleRequestInternal
(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, AbstractHttpSockJsSession sockJsSession) protected abstract String[]
readMessages
(ServerHttpRequest request) Methods inherited from class org.springframework.web.socket.sockjs.transport.handler.AbstractTransportHandler
getServiceConfig, initialize
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.web.socket.sockjs.transport.TransportHandler
getTransportType
-
Constructor Details
-
AbstractHttpReceivingTransportHandler
public AbstractHttpReceivingTransportHandler()
-
-
Method Details
-
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
-
handleRequest
public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, SockJsSession wsSession) throws SockJsException Description copied from interface:TransportHandler
Handle the given request and delegate messages to the providedWebSocketHandler
.- Parameters:
request
- the current requestresponse
- the current responsewsHandler
- the target WebSocketHandler (nevernull
)wsSession
- the SockJS session (nevernull
)- Throws:
SockJsException
- raised when request processing fails as explained inSockJsService
-
handleRequestInternal
protected void handleRequestInternal(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, AbstractHttpSockJsSession sockJsSession) throws SockJsException - Throws:
SockJsException
-
readMessages
- Throws:
IOException
-
getResponseStatus
-