开发者

How to get hold of the (un)marshalled message for logging

I have a Spring MVC REST service that uses XStream to convert the messages to and from XML.

开发者_如何学Python

Is there any way I can print the xml (ie the body) from the request and response to a normal log4j logger?

Inside the controller won't work cause by then XStream has alread unmarshalled the request and not yet marshalled the response.

A filter in the servlet isn't very nice either as it will consume the body by reading it.

And thats where I run out if ideas. So, SO? Any takers? :)


You can use an interceptor to log your request and response content coming to your specific rest uri's - More details here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜