使用resteasy记录JSON帖子 [英] Logging json posts with resteasy

查看:161
本文介绍了使用resteasy记录JSON帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种在RESTEASY框架中记录JSON帖子的方法.

I'm looking for a way to log JSON posts in a RESTEASY framework.

我想记录POST正文以记录文件,以查看客户端向我发送的内容.

I woul like to log the POST body to log file to see what the client is sending to me.

有没有可以使用的拦截器或类似的东西,我找到了PreProcessInterceptor的示例,但它似乎已弃用.

Is there any interceptor or something similar that I can use, I have found an example for PreProcessInterceptor but it looks like it is deprecated.

我正在使用resteasy 3.0.8

I'm using resteasy 3.0.8

推荐答案

您可以使用

代替检查方法和内容类型,您还可以按

Instead of checking for Method and Content-Type you can also register this filter per @NameBinding only where you need it.

注意::这个简单的示例复制了请求的InputStream,因此它将被读取两次(可能是性能问题).

Note: This simple example copies the InputStream of the request so it will be read twice (maybe a performance problem).

这篇关于使用resteasy记录JSON帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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