Java – record JSON requests and responses for JSON

I have a Java Web application that exposes restful APIs My requirement is to record all JSON requests and responses processed by the server

I'm also exploring the AOP method What method signatures should I add to the AOP schema?

I am using Tomcat server and Sweatshirt to implement jax-rs

Solution

Use loggingfilter Just add the following to your web In XML:

<init-param>
  <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
  <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
</init-param>
<init-param>
  <param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>
  <param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>
</init-param>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>