Announcement Announcement Module
Collapse
No announcement yet.
Spring MVC, force JSON response in plain request (Accept text/html, application/xhtm) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring MVC, force JSON response in plain request (Accept text/html, application/xhtm)

    I am using Spring 3.0.6 and i have a controller for uploading files to the server. I am using a script to upload using XmlHttpRequest for browsers that support it while the rest of the browsers submit a (hidden) multipart form. The problem however is that when a form is submitted, the browser sends by default the following header:

    Accept text/html, application/xhtml+xml, */*

    I figure that due to this header the Controller which is marked with @ResponseBody replies with the response been converted to XML instead of JSON. Is there a way to get around this without hacking the form submit request?
Working...
X