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:
JsonpReceivingTransportHandler
,XhrReceivingTransportHandler
public abstract class AbstractHttpReceivingTransportHandler extends AbstractTransportHandler
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, UTF8_CHARSET
Constructor Summary
Constructors Constructor Description AbstractHttpReceivingTransportHandler()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
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 HttpStatus
getResponseStatus()
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 Detail
AbstractHttpReceivingTransportHandler
public AbstractHttpReceivingTransportHandler()
Method Detail
checkSessionType
public boolean checkSessionType(SockJsSession session)
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
protected abstract String[] readMessages(ServerHttpRequest request) throws IOException
- Throws:
IOException
getResponseStatus
protected abstract HttpStatus getResponseStatus()