title: Java HttpPost Body Apache 4.3.2
body: <p>I am trying to make an HttpRequest of type POST using the Apache Java LIB 4.3.2 and I am having a problem.</p>
  
  <p>There is no method to set the body neither a parameter value...</p>
  
  <p>I am trying to set flac binary on the body of the post http request.</p>
  
  <p>Here is my sample code:</p>
  
  <pre><code>import org.apache.http.HttpEntity;
  import org.apache.http.HttpResponse;
  import org.apache.http.client.HttpClient;
  import org.apache.http.client.methods.HttpPost;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.apache.http.util.EntityUtils;
  
  
  
  
  public class GoogleSpeech {
  
      /**
       * @param args
       */
      public static void main(String[] args) {
          try {
              HttpClient client = new DefaultHttpClient();  
              String getURL = "https://www.google.com/speech-api/v1/recognize?client=chromium&amp;lang=pt-PT&amp;maxresults=10";
  
  
  
              HttpPost get = new HttpPost(getURL);
  
              get.setHeader("Content-Type", " audio/x-flac; rate=16000;");
              get.setHeader("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7");
  
  
  
              HttpResponse responseGet = client.execute(get);  
              System.out.println(responseGet);
  
      } catch (Exception e) {
          e.printStackTrace();
      }
  
      }
  
  }
  </code></pre>