Interface TransportHandler
- All Known Implementing Classes:
AbstractHttpReceivingTransportHandler
,AbstractHttpSendingTransportHandler
,AbstractTransportHandler
,EventSourceTransportHandler
,HtmlFileTransportHandler
,WebSocketTransportHandler
,XhrPollingTransportHandler
,XhrReceivingTransportHandler
,XhrStreamingTransportHandler
public interface TransportHandler
Handle a SockJS session URL, i.e. transport-specific request.- Since:
- 4.0
- Author:
- Rossen Stoyanchev, Juergen Hoeller
Method Summary
All Methods Instance Methods Abstract 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.TransportType
getTransportType()
Return the transport type supported by this handler.void
handleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler handler, SockJsSession session)
Handle the given request and delegate messages to the providedWebSocketHandler
.void
initialize(SockJsServiceConfig serviceConfig)
Initialize this handler with the given configuration.
Method Detail
initialize
void initialize(SockJsServiceConfig serviceConfig)
Initialize this handler with the given configuration.- Parameters:
serviceConfig
- the configuration as defined by the containingSockJsService
getTransportType
TransportType getTransportType()
Return the transport type supported by this handler.
checkSessionType
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.- Returns:
true
if the session matches (and would therefore get accepted byhandleRequest(org.springframework.http.server.ServerHttpRequest, org.springframework.http.server.ServerHttpResponse, org.springframework.web.socket.WebSocketHandler, org.springframework.web.socket.sockjs.transport.SockJsSession)
), orfalse
otherwise- Since:
- 4.3.4
handleRequest
void handleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler handler, SockJsSession session) throws SockJsException
Handle the given request and delegate messages to the providedWebSocketHandler
.- Parameters:
request
- the current requestresponse
- the current responsehandler
- the target WebSocketHandler (nevernull
)session
- the SockJS session (nevernull
)- Throws:
SockJsException
- raised when request processing fails as explained inSockJsService