Class AbstractStandardUpgradeStrategy
java.lang.Object
org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy
- All Implemented Interfaces:
RequestUpgradeStrategy
- Direct Known Subclasses:
AbstractTyrusRequestUpgradeStrategy,StandardWebSocketUpgradeStrategy
public abstract class AbstractStandardUpgradeStrategy
extends Object
implements RequestUpgradeStrategy
A base class for
RequestUpgradeStrategy implementations that build
on the standard WebSocket API for Java (JSR-356).- Since:
- 4.0
- Author:
- Rossen Stoyanchev
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ServerContainergetContainer(HttpServletRequest request) protected final HttpServletRequestgetHttpServletRequest(ServerHttpRequest request) protected final HttpServletResponsegetHttpServletResponse(ServerHttpResponse response) protected List<WebSocketExtension>getInstalledExtensions(WebSocketContainer container) getSupportedExtensions(ServerHttpRequest request) Return the WebSocket protocol extensions supported by the underlying WebSocket server.voidupgrade(ServerHttpRequest request, ServerHttpResponse response, String selectedProtocol, List<WebSocketExtension> selectedExtensions, Principal user, WebSocketHandler wsHandler, Map<String, Object> attrs) Perform runtime specific steps to complete the upgrade.protected abstract voidupgradeInternal(ServerHttpRequest request, ServerHttpResponse response, String selectedProtocol, List<Extension> selectedExtensions, Endpoint endpoint) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.socket.server.RequestUpgradeStrategy
getSupportedVersions
-
Field Details
-
logger
-
-
Constructor Details
-
AbstractStandardUpgradeStrategy
public AbstractStandardUpgradeStrategy()
-
-
Method Details
-
getContainer
-
getHttpServletRequest
-
getHttpServletResponse
-
getSupportedExtensions
Description copied from interface:RequestUpgradeStrategyReturn the WebSocket protocol extensions supported by the underlying WebSocket server.- Specified by:
getSupportedExtensionsin interfaceRequestUpgradeStrategy
-
getInstalledExtensions
-
upgrade
public void upgrade(ServerHttpRequest request, ServerHttpResponse response, @Nullable String selectedProtocol, List<WebSocketExtension> selectedExtensions, @Nullable Principal user, WebSocketHandler wsHandler, Map<String, Object> attrs) throws HandshakeFailureExceptionDescription copied from interface:RequestUpgradeStrategyPerform runtime specific steps to complete the upgrade. Invoked after successful negotiation of the handshake request.- Specified by:
upgradein interfaceRequestUpgradeStrategy- Parameters:
request- the current requestresponse- the current responseselectedProtocol- the selected sub-protocol, if anyselectedExtensions- the selected WebSocket protocol extensionsuser- the user to associate with the WebSocket sessionwsHandler- the handler for WebSocket messagesattrs- handshake request specific attributes to be set on the WebSocket session viaHandshakeInterceptorand thus made available to theWebSocketHandler- Throws:
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.
-
upgradeInternal
protected abstract void upgradeInternal(ServerHttpRequest request, ServerHttpResponse response, @Nullable String selectedProtocol, List<Extension> selectedExtensions, Endpoint endpoint) throws HandshakeFailureException - Throws:
HandshakeFailureException
-