title: xmlhttprequest responsetext coming for Accept header: text/xml , but server error for application/JSON
body: <p>I have to get response text from a resourceindex page as  JSON object. When I dont put a Accept header in the request, it shows me the xml response (i see it in an alert)..</p>
  
  <p>But I want the response as a JSON object.. What should I do. One solution would have been</p>
  
  <pre><code>httpRequest.setRequestHeader('Accept', 'application/JSON');
  </code></pre>
  
  <p>but this gives me a server error :500</p>
  
  <p>Also it says </p>
  
  <blockquote>
    <p>A message body writer for Java type, class ...., and MIME media type, application/octet-stream, was not found</p>
  </blockquote>
  
  <p>Can someone suggest on what to do to overcome this and get the response as JSON?</p>