类 ReactorNettyRequestUpgradeStrategy
- java.lang.Object
- org.springframework.web.reactive.socket.server.upgrade.ReactorNettyRequestUpgradeStrategy
- 所有已实现的接口:
RequestUpgradeStrategy
public class ReactorNettyRequestUpgradeStrategy extends Object implements RequestUpgradeStrategy
ARequestUpgradeStrategy
for use with Reactor Netty.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 ReactorNettyRequestUpgradeStrategy()
Create an instances with a defaultWebsocketServerSpec.Builder
.ReactorNettyRequestUpgradeStrategy(Supplier<reactor.netty.http.server.WebsocketServerSpec.Builder> builderSupplier)
Create an instance with a pre-configuredWebsocketServerSpec.Builder
to use for WebSocket upgrades.
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 boolean
getHandlePing()
已过时。as of 5.2.6 in favor ofgetWebsocketServerSpec()
int
getMaxFramePayloadLength()
已过时。as of 5.2.6 in favor ofgetWebsocketServerSpec()
reactor.netty.http.server.WebsocketServerSpec
getWebsocketServerSpec()
Build an instance ofWebsocketServerSpec
that reflects the current configuration.void
setHandlePing(boolean handlePing)
已过时。as of 5.2.6 in favor of providing a supplier ofWebsocketServerSpec.Builder
wiht a constructor argument.void
setMaxFramePayloadLength(Integer maxFramePayloadLength)
已过时。as of 5.2.6 in favor of providing a supplier ofWebsocketServerSpec.Builder
wiht a constructor argument.reactor.core.publisher.Mono<Void>
upgrade(ServerWebExchange exchange, WebSocketHandler handler, String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory)
Upgrade to a WebSocket session and handle it with the given handler.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.web.reactive.socket.server.RequestUpgradeStrategy
upgrade
构造器详细资料
ReactorNettyRequestUpgradeStrategy
public ReactorNettyRequestUpgradeStrategy()
Create an instances with a defaultWebsocketServerSpec.Builder
.- 从以下版本开始:
- 5.2.6
ReactorNettyRequestUpgradeStrategy
public ReactorNettyRequestUpgradeStrategy(Supplier<reactor.netty.http.server.WebsocketServerSpec.Builder> builderSupplier)
Create an instance with a pre-configuredWebsocketServerSpec.Builder
to use for WebSocket upgrades.- 从以下版本开始:
- 5.2.6
方法详细资料
getWebsocketServerSpec
public reactor.netty.http.server.WebsocketServerSpec getWebsocketServerSpec()
Build an instance ofWebsocketServerSpec
that reflects the current configuration. This can be used to check the configured parameters except for sub-protocols which depend on theWebSocketHandler
that is used for a given upgrade.- 从以下版本开始:
- 5.2.6
setMaxFramePayloadLength
@Deprecated public void setMaxFramePayloadLength(Integer maxFramePayloadLength)
已过时。as of 5.2.6 in favor of providing a supplier ofWebsocketServerSpec.Builder
wiht a constructor argument.Configure the maximum allowable frame payload length. Setting this value to your application's requirement may reduce denial of service attacks using long data frames.Corresponds to the argument with the same name in the constructor of
WebSocketServerHandshakerFactory
in Netty.By default set to 65536 (64K).
- 参数:
maxFramePayloadLength
- the max length for frames.- 从以下版本开始:
- 5.1
getMaxFramePayloadLength
@Deprecated public int getMaxFramePayloadLength()
已过时。as of 5.2.6 in favor ofgetWebsocketServerSpec()
Return the configured max length for frames.- 从以下版本开始:
- 5.1
setHandlePing
@Deprecated public void setHandlePing(boolean handlePing)
已过时。as of 5.2.6 in favor of providing a supplier ofWebsocketServerSpec.Builder
wiht a constructor argument.Configure whether to let ping frames through to be handled by theWebSocketHandler
given to the upgrade method. By default, Reactor Netty automatically replies with pong frames in response to pings. This is useful in a proxy for allowing ping and pong frames through.By default this is set to
false
in which case ping frames are handled automatically by Reactor Netty. If set totrue
, ping frames will be passed through to theWebSocketHandler
.- 参数:
handlePing
- whether to let Ping frames through for handling- 从以下版本开始:
- 5.2.4
getHandlePing
@Deprecated public boolean getHandlePing()
已过时。as of 5.2.6 in favor ofgetWebsocketServerSpec()
Return the configuredsetHandlePing(boolean)
.- 从以下版本开始:
- 5.2.4
upgrade
public reactor.core.publisher.Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler handler, @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory)
从接口复制的说明:RequestUpgradeStrategy
Upgrade to a WebSocket session and handle it with the given handler.- 指定者:
upgrade
在接口中RequestUpgradeStrategy
- 参数:
exchange
- the current exchangehandler
- handler for the WebSocket sessionsubProtocol
- the selected sub-protocol got the handlerhandshakeInfoFactory
- factory to create HandshakeInfo for the WebSocket session- 返回:
- completion
Mono<Void>
to indicate the outcome of the WebSocket session handling.