spring-framework / org.springframework.web.socket.server.support

Package org.springframework.web.socket.server.support

Types

AbstractHandshakeHandler

abstract class AbstractHandshakeHandler : HandshakeHandler, Lifecycle

A base class for HandshakeHandler implementations, independent from the Servlet API.

Performs initial validation of the WebSocket handshake request - possibly rejecting it through the appropriate HTTP status code - while also allowing its subclasses to override various parts of the negotiation process (e.g. origin validation, sub-protocol negotiation, extensions negotiation, etc).

If the negotiation succeeds, the actual upgrade is delegated to a server-specific org.springframework.web.socket.server.RequestUpgradeStrategy, which will update the response as necessary and initialize the WebSocket. Currently supported servers are Jetty 9.0-9.3, Tomcat 7.0.47+ and 8.x, Undertow 1.0-1.3, GlassFish 4.1+, WebLogic 12.1.3+.

HandshakeInterceptorChain

open class HandshakeInterceptorChain

A helper class that assists with invoking a list of handshake interceptors.

HttpSessionHandshakeInterceptor

open class HttpSessionHandshakeInterceptor : HandshakeInterceptor

An interceptor to copy information from the HTTP session to the "handshake attributes" map to made available viaWebSocketSession#getAttributes().

Copies a subset or all HTTP session attributes and/or the HTTP session id under the key #HTTP_SESSION_ID_ATTR_NAME.

WebSocketHandlerMapping

open class WebSocketHandlerMapping : SimpleUrlHandlerMapping, SmartLifecycle

An extension of SimpleUrlHandlerMapping that is also a SmartLifecycle container and propagates start and stop calls to any handlers that implement Lifecycle. The handlers are typically expected to be WebSocketHttpRequestHandler or SockJsHttpRequestHandler.

WebSocketHttpRequestHandler

open class WebSocketHttpRequestHandler : HttpRequestHandler, Lifecycle, ServletContextAware

A HttpRequestHandler for processing WebSocket handshake requests.

This is the main class to use when configuring a server WebSocket at a specific URL. It is a very thin wrapper around a WebSocketHandler and a HandshakeHandler, also adapting the HttpServletRequest and HttpServletResponse to ServerHttpRequest and ServerHttpResponse, respectively.