title: Mapping restful ajax requests to spring
body: <p>I have this piece of code:</p>
  
  <pre><code>@RequestMapping(value = "/test.json", method = RequestMethod.GET)
  @ResponseStatus(HttpStatus.OK)
  public @ResponseBody Object[] generateFile(@RequestParam String tipo) {
      Object[] variaveis = Variavel.getListVariavelByTipo(tipo);
      return variaveis;
  }
  </code></pre>
  
  <p>As far as I know it should take a request to test.json?tipo=H and return the JSON representation of Variavel[], however when I make such request I get:</p>
  
  <p>HTTP Status 406 -</p>
  
  <p>type Status report</p>
  
  <p>message</p>
  
  <p>descriptionThe resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers ()</p>
  
  <p>By using the following function I can get the expected json:</p>
  
  <pre><code>@RequestMapping(value = "/teste.json")
  public void testeJson(Model model, @RequestParam String tipo) {
      model.addAttribute("data", Variavel.getListVariavelByTipo("H"));
  }
  </code></pre>
  
  <p>What I'm doing wrong?</p>