title: POST request becomes GET
body: <p>I am developing an Android and a server application in Java.
  The server application runs on Jetty. The Android application is emulated on the same computer.</p>
  
  <p>The Android application sends a POST request to the server, but the handler of the server interpret it as a GET.</p>
  
  <p>When I use <em>Send HTTP Tool</em> to simulate POST request, it works perfectly (I mean the type of the method is POST).</p>
  
  <p>This is the code-fragment of the Android application:</p>
  
  <pre><code>HttpClient client = new DefaultHttpClient();
  HttpConnectionParams.setConnectionTimeout(client.getParams(),
          10000); // Timeout Limit
  HttpResponse response;
  
  // Create message
  JSONObject json = new JSONObject();
  json.put("request_type", "info");
  json.put("user_name", mEmail);
  
  // Send message and get response
  StringEntity se = new StringEntity(json.toString());
  se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
  HttpPost post = new HttpPost("http://10.0.2.2:8080/app");
  post.setEntity(se);
  post.setHeader("Accept", "application/json");
  post.setHeader("Content-Type", "application/json; charset=UTF-8");
  response = client.execute(post);
  </code></pre>
  
  <p>And this is the code of the handler:</p>
  
  <pre><code>public void handle(String target, Request baseRequest, 
      HttpServletRequest request, HttpServletResponse response) {
      System.out.println(request.getMethod());
  }
  </code></pre>
  
  <p>I don't know what could be a problem, as I think if I use HttpPost, the method type should be POST.</p>