Spring 3 includes the ContentnegotiatingViewResolver which can be used to decide on the views based on Aceept HTTP header for example开发者_JAVA百科.
This would be one way to render a json view, another way (which also provides mapping for incoming request bodies to objects) would be to setup the MappingJacksonHttpMessageConverter.
Which one is used best? Are there any guidelines or hints?
Thanx!
MappingJacksonHttpMessageConverter looks alike a good approach , in case you want to skip the view resolution altogether.
HttpMessageConverter would allow you to do do more like XML,etcImages,etc easily and you can also unit test them :)
精彩评论