Top Description Fields Constructors Methods
org.springframework.web.socket.server.standard

public Class StandardWebSocketUpgradeStrategy

extends AbstractStandardUpgradeStrategy
Class Inheritance
Known Direct Subclasses
org.springframework.web.socket.server.standard.TomcatRequestUpgradeStrategy, org.springframework.web.socket.server.standard.UndertowRequestUpgradeStrategy, org.springframework.web.socket.server.standard.WebSphereRequestUpgradeStrategy
Imports
java.util.Collections, .List, .Map, jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, jakarta.websocket.Endpoint, .Extension, jakarta.websocket.server.ServerEndpointConfig, org.springframework.http.server.ServerHttpRequest, .ServerHttpResponse, org.springframework.lang.Nullable, org.springframework.web.socket.server.HandshakeFailureException

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.

To modify properties of the underlying jakarta.websocket.server.ServerContainer you can use ServletServerContainerFactoryBean in XML configuration or, when using Java configuration, access the container instance through the "jakarta.websocket.server.ServerContainer" ServletContext attribute.

Authors
Juergen Hoeller, Rossen Stoyanchev
Since
6.0
See Also
jakarta.websocket.server.ServerContainer#upgradeHttpToWebSocket

Field Summary

Modifier and TypeField and Description
private static final String[]
Inherited from org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy:
logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String[]
protected void
protected void
Inherited from org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy:
getContainergetHttpServletRequestgetHttpServletResponsegetInstalledExtensionsgetSupportedExtensionsupgrade

Field Detail

SUPPORTED_VERSIONSback to summary
private static final String[] SUPPORTED_VERSIONS

Constructor Detail

StandardWebSocketUpgradeStrategyback to summary
public StandardWebSocketUpgradeStrategy()

Method Detail

getSupportedVersionsback to summary
public String[] getSupportedVersions()

Implements org.springframework.web.socket.server.RequestUpgradeStrategy.getSupportedVersions.

Doc from org.springframework.web.socket.server.RequestUpgradeStrategy.getSupportedVersions.

Return the supported WebSocket protocol versions.

Annotations
@Override
upgradeHttpToWebSocketback to summary
protected void upgradeHttpToWebSocket(HttpServletRequest request, HttpServletResponse response, ServerEndpointConfig endpointConfig, Map<String, String> pathParams) throws Exception
upgradeInternalback to summary
protected void upgradeInternal(ServerHttpRequest request, ServerHttpResponse response, String selectedProtocol, List<Extension> selectedExtensions, Endpoint endpoint) throws HandshakeFailureException

Implements abstract org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy.upgradeInternal.

Annotations
@Override