Meaningless Drivel is fun!*
The moose likes Spring and the fly likes REST web service return both XML or JSON Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "REST web service return both XML or JSON" Watch "REST web service return both XML or JSON" New topic
Author

REST web service return both XML or JSON

Brian Moeller
Greenhorn

Joined: Feb 04, 2011
Posts: 1
I am trying to have a REST web service return both XML or JSON depending on the extension on the url (.xml .json).
As it is now it will ONLY return JSON no matter the extension.

Here is the method:


Here is my servlet-context.xml:



What am I doing wrong?
Thanks in advance for the help.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

I think, but you need to check the documentation that to get that affect, you need to configure the ContentNegotiatingViewResolver instead of using <mvc:annoation-drive/>

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
Don't get me started about those stupid light bulbs.
 
subject: REST web service return both XML or JSON