File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

REST web service return both XML or JSON

 
Brian Moeller
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic