接口 RequestUpgradeStrategy
- 所有已知实现类:
AbstractStandardUpgradeStrategy,AbstractTyrusRequestUpgradeStrategy,GlassFishRequestUpgradeStrategy,JettyRequestUpgradeStrategy,TomcatRequestUpgradeStrategy,UndertowRequestUpgradeStrategy,WebLogicRequestUpgradeStrategy,WebSphereRequestUpgradeStrategy
public interface RequestUpgradeStrategy
A server-specific strategy for performing the actual upgrade to a WebSocket exchange.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 List<WebSocketExtension>getSupportedExtensions(ServerHttpRequest request)Return the WebSocket protocol extensions supported by the underlying WebSocket server.String[]getSupportedVersions()Return the supported WebSocket protocol versions.voidupgrade(ServerHttpRequest request, ServerHttpResponse response, String selectedProtocol, List<WebSocketExtension> selectedExtensions, Principal user, WebSocketHandler wsHandler, Map<String,Object> attributes)Perform runtime specific steps to complete the upgrade.
方法详细资料
getSupportedVersions
String[] getSupportedVersions()
Return the supported WebSocket protocol versions.
getSupportedExtensions
List<WebSocketExtension> getSupportedExtensions(ServerHttpRequest request)
Return the WebSocket protocol extensions supported by the underlying WebSocket server.
upgrade
void upgrade(ServerHttpRequest request, ServerHttpResponse response, @Nullable String selectedProtocol, List<WebSocketExtension> selectedExtensions, @Nullable 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.- 参数:
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 messagesattributes- handshake request specific attributes to be set on the WebSocket session viaHandshakeInterceptorand thus made available to theWebSocketHandler- 抛出:
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.