Class StandardWebSocketUpgradeStrategy
java.lang.Object
org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy
org.springframework.web.socket.server.standard.StandardWebSocketUpgradeStrategy
- All Implemented Interfaces:
RequestUpgradeStrategy
- Direct Known Subclasses:
TomcatRequestUpgradeStrategy
,UndertowRequestUpgradeStrategy
,WebSphereRequestUpgradeStrategy
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 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.
- Since:
- 6.0
- Author:
- Juergen Hoeller, Rossen Stoyanchev
- See Also:
-
Field Summary
Fields inherited from class org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionString[]
Return the supported WebSocket protocol versions.protected void
upgradeHttpToWebSocket
(HttpServletRequest request, HttpServletResponse response, ServerEndpointConfig endpointConfig, Map<String, String> pathParams) protected void
upgradeInternal
(ServerHttpRequest request, ServerHttpResponse response, String selectedProtocol, List<Extension> selectedExtensions, Endpoint endpoint) Methods inherited from class org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy
getContainer, getHttpServletRequest, getHttpServletResponse, getInstalledExtensions, getSupportedExtensions, upgrade
-
Constructor Details
-
StandardWebSocketUpgradeStrategy
public StandardWebSocketUpgradeStrategy()
-
-
Method Details
-
getSupportedVersions
Description copied from interface:RequestUpgradeStrategy
Return the supported WebSocket protocol versions. -
upgradeInternal
protected void upgradeInternal(ServerHttpRequest request, ServerHttpResponse response, @Nullable String selectedProtocol, List<Extension> selectedExtensions, Endpoint endpoint) throws HandshakeFailureException - Specified by:
upgradeInternal
in classAbstractStandardUpgradeStrategy
- Throws:
HandshakeFailureException
-
upgradeHttpToWebSocket
protected void upgradeHttpToWebSocket(HttpServletRequest request, HttpServletResponse response, ServerEndpointConfig endpointConfig, Map<String, String> pathParams) throws Exception- Throws:
Exception
-