Interface RequestUpgradeStrategy
- All Known Implementing Classes:
JettyRequestUpgradeStrategy
,ReactorNettyRequestUpgradeStrategy
,TomcatRequestUpgradeStrategy
,UndertowRequestUpgradeStrategy
public interface RequestUpgradeStrategy
A strategy for upgrading an HTTP request to a WebSocket session depending on the underlying network runtime.Typically there is one such strategy for every
ServerHttpRequest
andServerHttpResponse
type except in the case of Servlet containers for which the standard Java WebSocket API JSR-356 does not define a way to upgrade a request so a custom strategy is needed for every Servlet container.- Since:
- 5.0
- Author:
- Rossen Stoyanchev
Method Summary
All Methods Instance Methods Default Methods Deprecated Methods Modifier and Type Method Description default reactor.core.publisher.Mono<Void>
upgrade(ServerWebExchange exchange, WebSocketHandler webSocketHandler, String subProtocol)
Deprecated.as of 5.1 in favor ofupgrade(ServerWebExchange, WebSocketHandler, String, Supplier)
default reactor.core.publisher.Mono<Void>
upgrade(ServerWebExchange exchange, WebSocketHandler webSocketHandler, String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory)
Upgrade to a WebSocket session and handle it with the given handler.
Method Detail
upgrade
@Deprecated default reactor.core.publisher.Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler webSocketHandler, @Nullable String subProtocol)
Deprecated.as of 5.1 in favor ofupgrade(ServerWebExchange, WebSocketHandler, String, Supplier)
Upgrade to a WebSocket session and handle it with the given handler.- Parameters:
exchange
- the current exchangewebSocketHandler
- handler for the WebSocket sessionsubProtocol
- the selected sub-protocol got the handler- Returns:
- completion
Mono<Void>
to indicate the outcome of the WebSocket session handling.
upgrade
default reactor.core.publisher.Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler webSocketHandler, @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory)
Upgrade to a WebSocket session and handle it with the given handler.- Parameters:
exchange
- the current exchangewebSocketHandler
- handler for the WebSocket sessionsubProtocol
- the selected sub-protocol got the handlerhandshakeInfoFactory
- factory to create HandshakeInfo for the WebSocket session- Returns:
- completion
Mono<Void>
to indicate the outcome of the WebSocket session handling. - Since:
- 5.1