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

public Class JettyRequestUpgradeStrategy

extends Object
implements RequestUpgradeStrategy
Class Inheritance
All Implemented Interfaces
org.springframework.web.reactive.socket.server.RequestUpgradeStrategy
Imports
java.util.function.Consumer, .Supplier, jakarta.servlet.ServletContext, jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, org.eclipse.jetty.ee10.websocket.server.JettyWebSocketCreator, .JettyWebSocketServerContainer, org.eclipse.jetty.websocket.api.Configurable, reactor.core.publisher.Mono, org.springframework.core.io.buffer.DataBufferFactory, org.springframework.http.server.reactive.ServerHttpRequest, .ServerHttpRequestDecorator, .ServerHttpResponse, .ServerHttpResponseDecorator, org.springframework.lang.Nullable, org.springframework.web.reactive.socket.HandshakeInfo, .WebSocketHandler, org.springframework.web.reactive.socket.adapter.ContextWebSocketHandler, .JettyWebSocketHandlerAdapter, .JettyWebSocketSession, org.springframework.web.reactive.socket.server.RequestUpgradeStrategy, org.springframework.web.server.ServerWebExchange

A WebSocket RequestUpgradeStrategy for Jetty 11.
Author
Rossen Stoyanchev
Since
5.3.4

Field Summary

Modifier and TypeField and Description
private JettyWebSocketServerContainer
private Consumer<Configurable>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addWebSocketConfigurer(Consumer<Configurable> webSocketConfigurer)

Add a callback to configure WebSocket server parameters on JettyWebSocketServerContainer.

private JettyWebSocketServerContainer
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

serverContainerback to summary
private JettyWebSocketServerContainer serverContainer
Annotations
@Nullable
webSocketConfigurerback to summary
private Consumer<Configurable> webSocketConfigurer
Annotations
@Nullable

Constructor Detail

JettyRequestUpgradeStrategyback to summary
public JettyRequestUpgradeStrategy()

Method Detail

addWebSocketConfigurerback to summary
public void addWebSocketConfigurer(Consumer<Configurable> webSocketConfigurer)

Add a callback to configure WebSocket server parameters on JettyWebSocketServerContainer.

Since
6.1
getWebSocketServerContainerback to summary
private JettyWebSocketServerContainer getWebSocketServerContainer(ServletContext servletContext)
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