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

public abstract Class AbstractStandardUpgradeStrategy

extends Object
implements RequestUpgradeStrategy
Class Inheritance
All Implemented Interfaces
org.springframework.web.socket.server.RequestUpgradeStrategy
Known Direct Subclasses
org.springframework.web.socket.server.standard.AbstractTyrusRequestUpgradeStrategy, org.springframework.web.socket.server.standard.StandardWebSocketUpgradeStrategy
Imports
java.net.InetSocketAddress, java.security.Principal, java.util.ArrayList, .List, .Map, jakarta.servlet.ServletContext, jakarta.servlet.http.HttpServletRequest, .HttpServletResponse, jakarta.websocket.Endpoint, .Extension, .WebSocketContainer, jakarta.websocket.server.ServerContainer, org.apache.commons.logging.Log, .LogFactory, org.springframework.http.HttpHeaders, org.springframework.http.server.ServerHttpRequest, .ServerHttpResponse, .ServletServerHttpRequest, .ServletServerHttpResponse, org.springframework.lang.Nullable, org.springframework.util.Assert, org.springframework.web.socket.WebSocketExtension, .WebSocketHandler, org.springframework.web.socket.adapter.standard.StandardToWebSocketExtensionAdapter, .StandardWebSocketHandlerAdapter, .StandardWebSocketSession, .WebSocketToStandardExtensionAdapter, org.springframework.web.socket.server.HandshakeFailureException, .RequestUpgradeStrategy

A base class for RequestUpgradeStrategy implementations that build on the standard WebSocket API for Java (JSR-356).
Author
Rossen Stoyanchev
Since
4.0

Field Summary

Modifier and TypeField and Description
private volatile List<WebSocketExtension>
protected final Log

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected ServerContainer
protected final HttpServletRequest
protected final HttpServletResponse
protected List<WebSocketExtension>
public List<WebSocketExtension>
getSupportedExtensions(ServerHttpRequest request)

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

Return the WebSocket protocol extensions supported by the underlying WebSocket server.

public void
upgrade(ServerHttpRequest
the current request
request
,
ServerHttpResponse
the current response
response
,
String
the selected sub-protocol, if any
selectedProtocol
,
List<WebSocketExtension>
the selected WebSocket protocol extensions
selectedExtensions
,
Principal
the user to associate with the WebSocket session
user
,
WebSocketHandler
the handler for WebSocket messages
wsHandler
,
Map<String, Object>
handshake request specific attributes to be set on the WebSocket session via org.springframework.web.socket.server.HandshakeInterceptor and thus made available to the org.springframework.web.socket.WebSocketHandler
attrs
)

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

Perform runtime specific steps to complete the upgrade.

protected abstract void
upgradeInternal(ServerHttpRequest request, ServerHttpResponse response, String selectedProtocol, List<Extension> selectedExtensions, Endpoint endpoint)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

extensionsback to summary
private volatile List<WebSocketExtension> extensions
Annotations
@Nullable
loggerback to summary
protected final Log logger

Constructor Detail

AbstractStandardUpgradeStrategyback to summary
public AbstractStandardUpgradeStrategy()

Method Detail

getContainerback to summary
protected ServerContainer getContainer(HttpServletRequest request)
getHttpServletRequestback to summary
protected final HttpServletRequest getHttpServletRequest(ServerHttpRequest request)
getHttpServletResponseback to summary
protected final HttpServletResponse getHttpServletResponse(ServerHttpResponse response)
getInstalledExtensionsback to summary
protected List<WebSocketExtension> getInstalledExtensions(WebSocketContainer container)
getSupportedExtensionsback to summary
public List<WebSocketExtension> getSupportedExtensions(ServerHttpRequest request)

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

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

Return the WebSocket protocol extensions supported by the underlying WebSocket server.

Annotations
@Override
upgradeback to summary
public void upgrade(ServerHttpRequest request, ServerHttpResponse response, String selectedProtocol, List<WebSocketExtension> selectedExtensions, Principal user, WebSocketHandler wsHandler, Map<String, Object> attrs) throws HandshakeFailureException

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

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

Perform runtime specific steps to complete the upgrade. Invoked after successful negotiation of the handshake request.

Parameters
request:ServerHttpRequest

the current request

response:ServerHttpResponse

the current response

selectedProtocol:String

the selected sub-protocol, if any

selectedExtensions:List<WebSocketExtension>

the selected WebSocket protocol extensions

user:Principal

the user to associate with the WebSocket session

wsHandler:WebSocketHandler

the handler for WebSocket messages

attrs:Map<String, Object>

handshake request specific attributes to be set on the WebSocket session via org.springframework.web.socket.server.HandshakeInterceptor and thus made available to the org.springframework.web.socket.WebSocketHandler

Annotations
@Override
Exceptions
HandshakeFailureException:
thrown when handshake processing failed to complete due to an internal, unrecoverable error, i.e. a server error as opposed to a failure to successfully negotiate the requirements of the handshake request.
upgradeInternalback to summary
protected abstract void upgradeInternal(ServerHttpRequest request, ServerHttpResponse response, String selectedProtocol, List<Extension> selectedExtensions, Endpoint endpoint) throws HandshakeFailureException