title: Get HashMap in Spring Controller
body: <p>Actually I am trying to make an android application for my office canteen for that a Spring web application is already there. In Android app I am showing all the items available for that particular day. Employee will fill qty to the respective item and just submit. For that I have created a webService in Spring controller and I am able to access all the items in android app through REST (using <code>getForObject</code>). I have given id's to EditText as item_id(taken from remote database using rest) and whenever user click on place order, I create one HashMap in that I put item_id, order qty for all the items. But I am facing problem to send that HashMap to Spring web application using rest. I tried to send Using <code>restTemplate.getForObject("http://172.16.1.2/webapp/rest/restPlaceOrder?order="+order, List.class);</code> . But it was receiving  in the form of  .../restPlaceOrder?order={1=2,2=7,8=4}. As you said I supposed to use postForObject instead of getForObject. Now i tried to use postForObject and also using @RequestBody in spring controller. But now whenever I use @RequestBody in spring controller, android restclient gives error that <strong>unsupported media type</strong>. So please help me in sending HashMap using postForObject and catch the same thing in spring controller. I am using code in android client as</p>
  
  <pre><code> HashMap&lt;Integer, Integer&gt; order=new HashMap&lt;Integer, Integer&gt;(); 
  order.put(1, 5); order.put(2, 4);
  String url="http://172.16.1.2/webapp/rest/restPlaceOrder"
  RestTemplate restTemplate1=new RestTemplate();
  restTemplate1.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
  List&lt;LinkedHashMap&gt; res=restTemplate1.postForObject(url, null, List.class, order);
  </code></pre>
  
  <p>and at web application in Spring Controller, I am using </p>
  
  <pre><code>@RequestMapping(value="/restPlaceOrder", method= {RequestMethod.GET, RequestMethod.POST}, headers="Accept=application/json")
      public @ResponseBody List&lt;Schedule&gt; placeOrder(@RequestBody HashMap&lt;Integer, Integer&gt; order, HttpServletRequest request, HttpServletResponse response, Model m){
           System.out.println("welcome taking request");
           /*problem is whenever i put @RequestBody, Restclient shows unsupported media type and if I remove @RequestBody, then it works but then how to get that HashMap here */  
          List&lt;Schedule&gt; sc=new ArrayList();
          return sc;
  
            } 
  </code></pre>