yfliuas opened a new issue #2393:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2393


   【说明】
   我们的业务场景是希望在请求之后获取responseBody,然后根据响应体写操作日志。
   问题转化----->请求做个切面,拦截resposeBody
   【尝试方案一】
   
使用HttpServerFilter,在使用@RestSchema的接口下可以正常工作,但是环境中存在大量的@RPCSchema注册的接口,此类接口使用HttpServerFilter拦截不到
   【尝试方案二】
   使用Handler,在原始的Handler可以获取requestBody,但是拿不到responseBody
   【尝试方案三】
   
使用AOP,由于我们的场景是做一个SDK类似的东西,尽可能不想让用户感知到细节,所以使用注解定义切面,这种场景下用户在接口前新增一个@AutoOperationLog,当有改注解时,记录操作日志,如果没有则do
 nothing。
   
   第三种方案在controller前面拦截,直接报失败返回:
   400 17ms 
   content-length : 70
   Content-Type : text/plain; charset=utf-8
   
   CommonExceptionData [message=Parameters not valid or types not match.]
   
   @liubao68 求教一下,就我的这个使用场景,目前java-chassis是否有更合适的机制解决?使用AOP拦截的第三种方案如何解决?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to