Top Description Fields Constructors Methods
org.springframework.web.reactive.socket.server.upgrade

public Class ReactorNetty2RequestUpgradeStrategy

extends Object
implements RequestUpgradeStrategy
Class Inheritance
All Implemented Interfaces
org.springframework.web.reactive.socket.server.RequestUpgradeStrategy
Imports
java.net.URI, java.util.function.Supplier, reactor.core.publisher.Mono, reactor.netty5.http.server.HttpServerResponse, .WebsocketServerSpec, org.springframework.core.io.buffer.Netty5DataBufferFactory, org.springframework.http.server.reactive.ServerHttpResponse, .ServerHttpResponseDecorator, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.web.reactive.socket.HandshakeInfo, .WebSocketHandler, org.springframework.web.reactive.socket.adapter.ReactorNetty2WebSocketSession, org.springframework.web.reactive.socket.server.RequestUpgradeStrategy, org.springframework.web.server.ServerWebExchange

A WebSocket RequestUpgradeStrategy for Reactor Netty for Netty 5.

This class is based on ReactorNettyRequestUpgradeStrategy.

Author
Violeta Georgieva
Since
6.0

Field Summary

Modifier and TypeField and Description
private final Supplier<WebsocketServerSpec.Builder>

Constructor Summary

AccessConstructor and Description
public
public
ReactorNetty2RequestUpgradeStrategy(Supplier<WebsocketServerSpec.Builder> builderSupplier)

Create an instance with a pre-configured WebsocketServerSpec.Builder to use for WebSocket upgrades.

Method Summary

Modifier and TypeMethod and Description
pack-priv WebsocketServerSpec
buildSpec(String subProtocol)

public WebsocketServerSpec
getWebsocketServerSpec()

Build an instance of WebsocketServerSpec that reflects the current configuration.

public Mono<Void>
upgrade(ServerWebExchange
the current exchange
exchange
,
WebSocketHandler
handler for the WebSocket session
handler
,
String
the selected sub-protocol got the handler
subProtocol
,
Supplier<HandshakeInfo>
factory to create HandshakeInfo for the WebSocket session
handshakeInfoFactory
)

Implements org.springframework.web.reactive.socket.server.RequestUpgradeStrategy.upgrade.

Upgrade to a WebSocket session and handle it with the given handler.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

specBuilderSupplierback to summary
private final Supplier<WebsocketServerSpec.Builder> specBuilderSupplier

Constructor Detail

ReactorNetty2RequestUpgradeStrategyback to summary
public ReactorNetty2RequestUpgradeStrategy()

Create an instances with a default WebsocketServerSpec.Builder.

Since
5.2.6
ReactorNetty2RequestUpgradeStrategyback to summary
public ReactorNetty2RequestUpgradeStrategy(Supplier<WebsocketServerSpec.Builder> builderSupplier)

Create an instance with a pre-configured WebsocketServerSpec.Builder to use for WebSocket upgrades.

Since
5.2.6

Method Detail

buildSpecback to summary
pack-priv WebsocketServerSpec buildSpec(String subProtocol)
getWebsocketServerSpecback to summary
public WebsocketServerSpec getWebsocketServerSpec()

Build an instance of WebsocketServerSpec that reflects the current configuration. This can be used to check the configured parameters except for sub-protocols which depend on the WebSocketHandler that is used for a given upgrade.

Since
5.2.6
upgradeback to summary
public Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler handler, String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory)

Implements org.springframework.web.reactive.socket.server.RequestUpgradeStrategy.upgrade.

Doc from org.springframework.web.reactive.socket.server.RequestUpgradeStrategy.upgrade.

Upgrade to a WebSocket session and handle it with the given handler.

Parameters
exchange:ServerWebExchange

the current exchange

handler:WebSocketHandler

handler for the WebSocket session

subProtocol:String

the selected sub-protocol got the handler

handshakeInfoFactory:Supplier<HandshakeInfo>

factory to create HandshakeInfo for the WebSocket session

Returns:Mono<Void>

completion Mono<Void> to indicate the outcome of the WebSocket session handling.

Annotations
@Override