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
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.protected abstract HttpStatusfinal voidhandleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, SockJsSession wsSession) Handle the given request and delegate messages to the providedWebSocketHandler.protected voidhandleRequestInternal(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, initializeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.socket.sockjs.transport.TransportHandler
getTransportType
-
Constructor Details
-
AbstractHttpReceivingTransportHandler
public AbstractHttpReceivingTransportHandler()
-
-
Method Details
-
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
-
handleRequest
public final void handleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, SockJsSession wsSession) throws SockJsException Description copied from interface:TransportHandlerHandle 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
-