title: Receiving POST Request on Server (Spring Framework) from Android Application
body: <p>I am sending a POST request to a Server from my Android Application. The Server is developed using Spring Framework. The request is received by the server but the parameter that I was sending is null/empty (shown in the log).</p>
  
  <p>The code used to send POST request is:</p>
  
  <pre><code>DefaultHttpClient hc=new DefaultHttpClient();  
  ResponseHandler &lt;String&gt; res=new BasicResponseHandler();  
  
  String postMessage = "json String";
  
  HttpPost postMethod=new HttpPost("http://ip:port/event/eventlogs/logs");  
  List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(1);    
  nameValuePairs.add(new BasicNameValuePair("json", postMessage));
  
  postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs));    
  hc.execute(postMethod,res); 
  </code></pre>
  
  <p>I have also tried to set HttpParams as follows but it has also failed:</p>
  
  <pre><code>HttpParams params = new BasicHttpParams();
  params.setParameter("json", postMessage);
  postMethod.setParams(params);
  </code></pre>
  
  <p>The code on Server side that received this request is:</p>
  
  <pre><code>@RequestMapping(value = "/eventlogs/logs", method = RequestMethod.POST)
  public String logs(@ModelAttribute("json") String json) {
  
      logger.debug("Received POST request:" + json);
  
      return null;
  }
  </code></pre>
  
  <p>The Logger message that I am logging shows:</p>
  
  <pre><code>Received POST request:
  </code></pre>
  
  <p>Any ideas what I am missing here ?</p>