接口 HandshakeInterceptor

    • 方法详细资料

      • beforeHandshake

        boolean beforeHandshake​(ServerHttpRequest request,
                                ServerHttpResponse response,
                                WebSocketHandler wsHandler,
                                Map<String,​Object> attributes)
                         throws Exception
        Invoked before the handshake is processed.
        参数:
        request - the current request
        response - the current response
        wsHandler - the target WebSocket handler
        attributes - attributes from the HTTP handshake to associate with the WebSocket session; the provided attributes are copied, the original map is not used.
        返回:
        whether to proceed with the handshake (true) or abort (false)
        抛出:
        Exception
      • afterHandshake

        void afterHandshake​(ServerHttpRequest request,
                            ServerHttpResponse response,
                            WebSocketHandler wsHandler,
                            Exception exception)
        Invoked after the handshake is done. The response status and headers indicate the results of the handshake, i.e. whether it was successful or not.
        参数:
        request - the current request
        response - the current response
        wsHandler - the target WebSocket handler
        exception - an exception raised during the handshake, or null if none