It's not a secret anymore!*
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: 17249
    
    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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: REST web service return both XML or JSON
 
Similar Threads
Spring LDAP/Active Directory Security: Authenticate User w/out Using an Admin/Mgr Account
javax.servlet.ServletException: No adapter for handler
STS springMVC project how to run on tomcat application
javax.servlet.ServletException: Could not resolve view with name home-- apache Velocity, spring
spring security 3.1 login not working.