Top Description Methods
org.springframework.web.socket.server

public Interface RequestUpgradeStrategy

Known Direct Implementers
org.springframework.web.socket.server.jetty.JettyRequestUpgradeStrategy, org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy
Imports
java.security.Principal, java.util.List, .Map, org.springframework.http.server.ServerHttpRequest, .ServerHttpResponse, org.springframework.lang.Nullable, org.springframework.web.socket.WebSocketExtension, .WebSocketHandler

A server-specific strategy for performing the actual upgrade to a WebSocket exchange.
Author
Rossen Stoyanchev
Since
4.0
See Also
org.springframework.web.socket.server.standard.StandardWebSocketUpgradeStrategy

Method Summary

Modifier and TypeMethod and Description
public List<WebSocketExtension>
getSupportedExtensions(ServerHttpRequest request)

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

public String[]
getSupportedVersions()

Return the supported WebSocket protocol versions.

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
attributes
)

Perform runtime specific steps to complete the upgrade.

Method Detail

getSupportedExtensionsback to summary
public List<WebSocketExtension> getSupportedExtensions(ServerHttpRequest request)

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

getSupportedVersionsback to summary
public String[] getSupportedVersions()

Return the supported WebSocket protocol versions.

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

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

attributes: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

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.