title: apache httpclient content length issue
body: <p>I am trying to post some JSON to a rest service using Apache Httpclient. However, I get this error :</p>
  
  <pre><code>    Exception in thread "main" org.apache.http.ProtocolException: Content-Length header already present
  </code></pre>
  
  <hr>
  
  <pre><code>UsernamePasswordCredentials defaultcreds = new UsernamePasswordCredentials(USER,
              PASS);
  
  
      HttpHost targetHost = new HttpHost("localhost", 8080, "http");
  
      DefaultHttpClient httpclient = new DefaultHttpClient();
  
      httpclient.getCredentialsProvider().setCredentials(
              new AuthScope(targetHost.getHostName(), targetHost.getPort()),
              new UsernamePasswordCredentials(USER, PASS));
  
  
      HttpPost httpPost = new HttpPost(urlSuffix) {};
  
      JSONObject holder = new JSONObject();
      holder.put("name", "this is a folder");
  
  
      StringEntity se = new StringEntity(holder.toString());
  
      httpPost.setHeader("Accept", "application/json");
      httpPost.setHeader("Content-type", "application/json");
      httpPost.setEntity(se);
  
  
  
      HttpResponse resp = httpclient.execute(targetHost,httpPost);
  
      System.out.println("Resp-&gt;" + resp.getStatusLine().getStatusCode());
  </code></pre>
  
  <hr>
  
  <p>I've read its because I'm setting the content length twice already, but I'm not sure how to fix it.</p>