title: Return JsonObject in spring restful webservice
body: <p>I am using spring framework. I have a webservice in Wepsphere server like that</p>
  
  <pre><code>@RequestMapping (value="/services/SayHello2Me" , method=RequestMethod.GET, headers="Accept=application/json")
  @ResponseBody
  public JSONObject SayHello2Me(HttpServletRequest request) throws Exception {
      String input = (String) request.getParameter("name");
      String output = "hello " + input + " :)";
      JSONObject outputJsonObj = new JSONObject();
      outputJsonObj.put("output", output);
          return outputJsonObj;
        }
  </code></pre>
  
  <p>When I call it form Chrome like <a href="http://myserver/services/sayHello2Me?name=" rel="noreferrer">http://myserver/services/sayHello2Me?name=</a>'baris', it returns me that error :</p>
  
  <blockquote>
    <p>Error 404: SRVE0295E: Error reported: 404</p>
  </blockquote>
  
  <p>If I change annotions in my webservice like that </p>
  
  <pre><code>@RequestMapping (value="/services/SayHello2Me")
  @ResponseBody
  public JSONObject SayHello2Me(HttpServletRequest request) throws Exception {
  
      String input = (String) request.getParameter("name");
      String output = "hello " + input + " :)";
      JSONObject outputJsonObj = new JSONObject();
      outputJsonObj.put("output", output);
  
      return outputJsonObj;
    } 
  </code></pre>
  
  <p>then when I call it form Chrome like <a href="http://myserver/services/sayHello2Me?name=" rel="noreferrer">http://myserver/services/sayHello2Me?name=</a>'baris', it returns me that error :</p>
  
  <blockquote>
    <p>Error 406: SRVE0295E: Error reported: 406</p>
  </blockquote>
  
  <p>There is a jsonobject problem because if I return String insted of jsonobject in same webservice it returns me successfully.</p>
  
  <p>How can I return Jsonobject in spring restful webservice?</p>