title: Error HTTP Status 406: @ResponseBody not returning data
body: <p>I have the following code in REST, Spring MVC. This code is supposed to return a JSON type data structure called ResponseText:</p>
  
  <pre><code>@RequestMapping(value="/movieTheater", headers = {"ACCEPT=*/*"}, method=RequestMethod.GET)
  public @ResponseBody ResponseText getCustomerInput(@RequestParam("name") String name, @RequestParam("price") Double price) {
      Transaction transaction = new Transaction();
      ResponseText result = new ResponseText();
  
      transaction.setMovieName(name);
      transaction.setTicketPrice(price);
      transaction.setDatetime(new Date());
  
      if(transactionService.addTransaction(transaction))
          result.setMessage(ResponseStatus.SUCCESS.getStatus());
      else
          result.setMessage(ResponseStatus.FAILED.getStatus());
      return result;
  } 
  </code></pre>
  
  <p>But when I am executing this code via the below URL in the browser, I am getting the below error:</p>
  
  <p>URL:</p>
  
  <pre><code>http://localhost:8080/SpringMVCMerchant/movieTheater.htm?name=Smurfs&amp;price=300.00
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>HTTP Status 406 -
  
  type Status report
  
  message
  
  description The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers.
  </code></pre>
  
  <p>I am unable to identify what I am doing wrong here. I looked up on the Net explaining this error, but still don't know what I am missing. I have given ACCEPT="<em>/</em>", which is supposed to cover all sorts of responses, right? 
  Please help! 
  Thanks in advance!</p>
  
  <p>** When I added the header</p>
  
  <pre><code>headers={"Accept: application/json, text/javascript"} 
  </code></pre>
  
  <p>instead of the above one, I got the following error:</p>
  
  <pre><code>HTTP Status 405 - Request method 'GET' not supported
  </code></pre>