I have a spring application which exchanges JSON with the mobile. Spring controller looks like this:
@RequestMapping(value = "/register", method = RequestMethod.POST, headers = {"Content-type=application/json"})
public String register(@RequestBody @Valid UserRegistrationRequest urf, BindingResult bindingResult) {
return toJson(someResponse);
}
I wonder, what is the best way to log http request body and response body? At the moment, I have custom json message converter and it logs a request body, before creating a bean out of json. and I use CustomTraceInterceptor to log a response body. Unfortunately, CustomTraceInterceptor doesn't allow to log request body.
Any advice for better solutions would be highly appreciated!
Thank you in advance.