public class HttpSessionHandshakeInterceptor extends java.lang.Object implements HandshakeInterceptor
WebSocketSession.getAttributes()
.Modifier and Type | Field and Description |
---|---|
private java.util.Collection<java.lang.String> |
attributeNames |
private static Log |
logger |
Constructor and Description |
---|
HttpSessionHandshakeInterceptor()
A constructor for copying all available HTTP session attributes.
|
HttpSessionHandshakeInterceptor(java.util.Collection<java.lang.String> attributeNames)
A constructor for copying a subset of HTTP session attributes.
|
Modifier and Type | Method and Description |
---|---|
void |
afterHandshake(ServerHttpRequest request,
ServerHttpResponse response,
WebSocketHandler wsHandler,
java.lang.Exception ex)
Invoked after the handshake is done.
|
boolean |
beforeHandshake(ServerHttpRequest request,
ServerHttpResponse response,
WebSocketHandler wsHandler,
java.util.Map<java.lang.String,java.lang.Object> attributes)
Invoked before the handshake is processed.
|
private static final Log logger
private java.util.Collection<java.lang.String> attributeNames
public HttpSessionHandshakeInterceptor()
public HttpSessionHandshakeInterceptor(java.util.Collection<java.lang.String> attributeNames)
attributeNames
- the HTTP session attributes to copypublic boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, java.util.Map<java.lang.String,java.lang.Object> attributes) throws java.lang.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
java.lang.Exception
public void afterHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, java.lang.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