public class HttpSessionHandshakeInterceptor extends Object implements HandshakeInterceptor
WebSocketSession.getAttributes()
.Constructor and Description |
---|
HttpSessionHandshakeInterceptor()
A constructor for copying all available HTTP session attributes.
|
HttpSessionHandshakeInterceptor(Collection<String> attributeNames)
A constructor for copying a subset of HTTP session attributes.
|
Modifier and Type | Method and Description |
---|---|
void |
afterHandshake(org.springframework.http.server.ServerHttpRequest request,
org.springframework.http.server.ServerHttpResponse response,
WebSocketHandler wsHandler,
Exception ex)
Invoked after the handshake is done.
|
boolean |
beforeHandshake(org.springframework.http.server.ServerHttpRequest request,
org.springframework.http.server.ServerHttpResponse response,
WebSocketHandler wsHandler,
Map<String,Object> attributes)
Invoked before the handshake is processed.
|
public HttpSessionHandshakeInterceptor()
public HttpSessionHandshakeInterceptor(Collection<String> attributeNames)
attributeNames
- the HTTP session attributes to copypublic boolean beforeHandshake(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, WebSocketHandler wsHandler, Map<String,Object> attributes) throws Exception
HandshakeInterceptor
beforeHandshake
in interface HandshakeInterceptor
request
- the current requestresponse
- the current responsewsHandler
- the target WebSocket handlerattributes
- attributes from the HTTP handshake to associate with the WebSocket
session; the provided attributes are copied, the original map is not used.true
or abort false
Exception
public void afterHandshake(org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response, WebSocketHandler wsHandler, Exception ex)
HandshakeInterceptor
afterHandshake
in interface HandshakeInterceptor
request
- the current requestresponse
- the current responsewsHandler
- the target WebSocket handlerex
- an exception raised during the handshake, or null