类 AbstractStandardUpgradeStrategy
- java.lang.Object
- org.springframework.web.socket.server.standard.AbstractStandardUpgradeStrategy
- 所有已实现的接口:
RequestUpgradeStrategy
- 直接已知子类:
AbstractTyrusRequestUpgradeStrategy,TomcatRequestUpgradeStrategy,UndertowRequestUpgradeStrategy,WebSphereRequestUpgradeStrategy
public abstract class AbstractStandardUpgradeStrategy extends Object implements RequestUpgradeStrategy
A base class forRequestUpgradeStrategyimplementations that build on the standard WebSocket API for Java (JSR-356).- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 构造器 说明 AbstractStandardUpgradeStrategy()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected ServerContainergetContainer(HttpServletRequest request)protected HttpServletRequestgetHttpServletRequest(ServerHttpRequest request)protected HttpServletResponsegetHttpServletResponse(ServerHttpResponse response)protected List<WebSocketExtension>getInstalledExtensions(WebSocketContainer container)List<WebSocketExtension>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)从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.web.socket.server.RequestUpgradeStrategy
getSupportedVersions
构造器详细资料
AbstractStandardUpgradeStrategy
public AbstractStandardUpgradeStrategy()
方法详细资料
getContainer
protected ServerContainer getContainer(HttpServletRequest request)
getHttpServletRequest
protected final HttpServletRequest getHttpServletRequest(ServerHttpRequest request)
getHttpServletResponse
protected final HttpServletResponse getHttpServletResponse(ServerHttpResponse response)
getSupportedExtensions
public List<WebSocketExtension> getSupportedExtensions(ServerHttpRequest request)
从接口复制的说明:RequestUpgradeStrategyReturn the WebSocket protocol extensions supported by the underlying WebSocket server.
getInstalledExtensions
protected List<WebSocketExtension> getInstalledExtensions(WebSocketContainer container)
upgrade
public void upgrade(ServerHttpRequest request, ServerHttpResponse response, @Nullable String selectedProtocol, List<WebSocketExtension> selectedExtensions, @Nullable Principal user, WebSocketHandler wsHandler, Map<String,Object> attrs) throws HandshakeFailureException
从接口复制的说明:RequestUpgradeStrategyPerform runtime specific steps to complete the upgrade. Invoked after successful negotiation of the handshake request.- 指定者:
upgrade在接口中RequestUpgradeStrategy- 参数:
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- 抛出:
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