Hi all,

Spring provides two ways to transform a java domain object into the representation that will be shipped to the client:

1. Content Negotiating View Resolver.
a) "Accept" parameter in the header.
b) Based on the URL: http://some/foo/1.xml, http://some/foo/1.json.
2. HTTP Message Converters (as explained in Pro Spring 3 book).

Roo supports REST through "json" add-on so we can request an object with:

curl -i -H "Accept: application/json" http://localhost:8080/addressbook/contacts/1

But, there isn't any "rest xml" add-on ready to use (http-representation add-on is obsolete). So the following command won't work:

curl -i -H "Accept: application/xml" http://localhost:8080/addressbook/contacts/1

And even more. The way Roo supports json is by creating a new controller instead of taking advantage of the ContentNegociatingViewResolver or HTTP Message Converters. Also Roo's command "web mvc all" makes the Controllers to return a String, the name of the view, instead of returning the object and delegating the view to a ViewResolver. Wouldn't the second approach be a better solution?

Does anyone know why? I don't mind to develop something for the community but first we need to know the direction. What would be the best approach?

Your thoughts?
Agustin