Class StandardWebSocketUpgradeStrategy
java.lang.Object
org.springframework.web.reactive.socket.server.upgrade.StandardWebSocketUpgradeStrategy
- All Implemented Interfaces:
- RequestUpgradeStrategy
- Direct Known Subclasses:
- TomcatRequestUpgradeStrategy
A WebSocket 
RequestUpgradeStrategy for the Jakarta WebSocket API 2.1+.
 This strategy serves as a fallback if no specific server has been detected. It can also be used with Jakarta EE 10 level servers such as Tomcat 10.1 and Undertow 2.3 directly, relying on their built-in Jakarta WebSocket 2.1 support.
- Since:
- 6.0
- Author:
- Juergen Hoeller, Violeta Georgieva, Rossen Stoyanchev
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected ServerContainergetContainer(HttpServletRequest request) voidsetAsyncSendTimeout(Long timeoutInMillis) Exposes the underlying config option onWebSocketContainer.setAsyncSendTimeout(long).voidsetMaxBinaryMessageBufferSize(Integer bufferSize) Exposes the underlying config option onWebSocketContainer.setDefaultMaxBinaryMessageBufferSize(int).voidsetMaxSessionIdleTimeout(Long timeoutInMillis) Exposes the underlying config option onWebSocketContainer.setDefaultMaxSessionIdleTimeout(long).voidsetMaxTextMessageBufferSize(Integer bufferSize) Exposes the underlying config option onWebSocketContainer.setDefaultMaxTextMessageBufferSize(int).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.protected voidupgradeHttpToWebSocket(HttpServletRequest request, HttpServletResponse response, ServerEndpointConfig endpointConfig, Map<String, String> pathParams) 
- 
Constructor Details- 
StandardWebSocketUpgradeStrategypublic StandardWebSocketUpgradeStrategy()
 
- 
- 
Method Details- 
setAsyncSendTimeoutExposes the underlying config option onWebSocketContainer.setAsyncSendTimeout(long).
- 
getAsyncSendTimeout
- 
setMaxSessionIdleTimeoutExposes the underlying config option onWebSocketContainer.setDefaultMaxSessionIdleTimeout(long).
- 
getMaxSessionIdleTimeout
- 
setMaxTextMessageBufferSizeExposes the underlying config option onWebSocketContainer.setDefaultMaxTextMessageBufferSize(int).
- 
getMaxTextMessageBufferSize
- 
setMaxBinaryMessageBufferSizeExposes the underlying config option onWebSocketContainer.setDefaultMaxBinaryMessageBufferSize(int).
- 
getMaxBinaryMessageBufferSize
- 
upgradepublic reactor.core.publisher.Mono<Void> upgrade(ServerWebExchange exchange, WebSocketHandler handler, @Nullable String subProtocol, Supplier<HandshakeInfo> handshakeInfoFactory) Description copied from interface:RequestUpgradeStrategyUpgrade to a WebSocket session and handle it with the given handler.- Specified by:
- upgradein interface- RequestUpgradeStrategy
- Parameters:
- exchange- the current exchange
- handler- handler for the WebSocket session
- subProtocol- the selected sub-protocol got the handler
- handshakeInfoFactory- factory to create HandshakeInfo for the WebSocket session
- Returns:
- completion Mono<Void>to indicate the outcome of the WebSocket session handling.
 
- 
upgradeHttpToWebSocketprotected void upgradeHttpToWebSocket(HttpServletRequest request, HttpServletResponse response, ServerEndpointConfig endpointConfig, Map<String, String> pathParams) throws Exception- Throws:
- Exception
 
- 
getContainer
 
-