使用GRPC服务器拦截器验证请求 [英] Validate request using GRPC server interceptor

查看:102
本文介绍了使用GRPC服务器拦截器验证请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用拦截器来验证并记录一些grpc服务请求的数据.我检查了ServerInterceptor的interceptCall,但找不到获取请求对象的方法.有什么办法可以在拦截器中获取请求对象?

I need to validate and log some of the data of grpc service request using an interceptor. I checked interceptCall of ServerInterceptor and could not find a way to get the request object. Is there any way to get the request object inside an interceptor ?

推荐答案

您需要返回并扩展 ForwardingServerCallListener 并收听 ServerCall.Listener.onMessage()回调.

You need to return and extend a ForwardingServerCallListener and listen to the ServerCall.Listener.onMessage() callback.

这篇关于使用GRPC服务器拦截器验证请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆