接口 TransportHandler
- 所有已知实现类:
AbstractHttpReceivingTransportHandler
,AbstractHttpSendingTransportHandler
,AbstractTransportHandler
,EventSourceTransportHandler
,HtmlFileTransportHandler
,JsonpPollingTransportHandler
,JsonpReceivingTransportHandler
,WebSocketTransportHandler
,XhrPollingTransportHandler
,XhrReceivingTransportHandler
,XhrStreamingTransportHandler
public interface TransportHandler
Handle a SockJS session URL, i.e. transport-specific request.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Juergen Hoeller
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 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.
方法详细资料
initialize
void initialize(SockJsServiceConfig serviceConfig)
Initialize this handler with the given configuration.- 参数:
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.- 返回:
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- 从以下版本开始:
- 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
.- 参数:
request
- the current requestresponse
- the current responsehandler
- the target WebSocketHandler (nevernull
)session
- the SockJS session (nevernull
)- 抛出:
SockJsException
- raised when request processing fails as explained inSockJsService