Class JettyRequestUpgradeStrategy
java.lang.Object
org.springframework.web.socket.server.jetty.JettyRequestUpgradeStrategy
- All Implemented Interfaces:
- Aware, ServletContextAware, RequestUpgradeStrategy
public class JettyRequestUpgradeStrategy
extends Object
implements RequestUpgradeStrategy, ServletContextAware
A 
RequestUpgradeStrategy for Jetty 12 EE11.- Since:
- 5.3.4
- Author:
- Rossen Stoyanchev
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddWebSocketConfigurer(Consumer<org.eclipse.jetty.websocket.api.Configurable> webSocketConfigurer) Add a callback to configure WebSocket server parameters onJettyWebSocketServerContainer.getSupportedExtensions(ServerHttpRequest request) Return the WebSocket protocol extensions supported by the underlying WebSocket server.String[]Return the supported WebSocket protocol versions.voidsetServletContext(ServletContext servletContext) Set theServletContextthat this object runs in.voidupgrade(ServerHttpRequest request, ServerHttpResponse response, @Nullable String selectedProtocol, List<WebSocketExtension> selectedExtensions, @Nullable Principal user, WebSocketHandler handler, Map<String, Object> attributes) Perform runtime specific steps to complete the upgrade.
- 
Constructor Details- 
JettyRequestUpgradeStrategypublic JettyRequestUpgradeStrategy()
 
- 
- 
Method Details- 
getSupportedVersionsDescription copied from interface:RequestUpgradeStrategyReturn the supported WebSocket protocol versions.- Specified by:
- getSupportedVersionsin interface- RequestUpgradeStrategy
 
- 
getSupportedExtensionsDescription copied from interface:RequestUpgradeStrategyReturn the WebSocket protocol extensions supported by the underlying WebSocket server.- Specified by:
- getSupportedExtensionsin interface- RequestUpgradeStrategy
 
- 
addWebSocketConfigurerpublic void addWebSocketConfigurer(Consumer<org.eclipse.jetty.websocket.api.Configurable> webSocketConfigurer) Add a callback to configure WebSocket server parameters onJettyWebSocketServerContainer.- Since:
- 6.1
 
- 
setServletContextDescription copied from interface:ServletContextAwareSet theServletContextthat this object runs in.Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSetor a custom init-method. Invoked after ApplicationContextAware'ssetApplicationContext.- Specified by:
- setServletContextin interface- ServletContextAware
- Parameters:
- servletContext- the ServletContext object to be used by this object
- See Also:
 
- 
upgradepublic void upgrade(ServerHttpRequest request, ServerHttpResponse response, @Nullable String selectedProtocol, List<WebSocketExtension> selectedExtensions, @Nullable Principal user, WebSocketHandler handler, Map<String, Object> attributes) throws HandshakeFailureExceptionDescription copied from interface:RequestUpgradeStrategyPerform runtime specific steps to complete the upgrade. Invoked after successful negotiation of the handshake request.- Specified by:
- upgradein interface- RequestUpgradeStrategy
- Parameters:
- request- the current request
- response- the current response
- selectedProtocol- the selected sub-protocol, if any
- selectedExtensions- the selected WebSocket protocol extensions
- user- the user to associate with the WebSocket session
- handler- the handler for WebSocket messages
- attributes- handshake request specific attributes to be set on the WebSocket session via- HandshakeInterceptorand thus made available to the- WebSocketHandler
- 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.
 
 
-