title: OAuth with Signpost and Apache Commons HTTP
body: <p>So I'm working with the <a href="http://code.google.com/p/oauth-signpost/" rel="noreferrer">Signpost</a> OAuth library for Java. I'm running into some complications using the Apache Commons HTTP library with it. Take a look at the following code:</p>
  
  <pre><code>URL url = new URL("http://api.neoseeker.com/forum/get_pm_counts.json");
  HttpRequest request = (HttpRequest) url.openConnection();
  
  consumer.sign(request);
  
  request.connect();
  
  System.out.println("Response: " + request.getResponseCode() + " "
          + request.getResponseMessage());
  </code></pre>
  
  <p>This is taking from <a href="https://github.com/kaeppler/signpost-examples/blob/master/OAuthTwitterExample/src/TwitterMain.java" rel="noreferrer">this example</a>. You can see that <code>request</code> used to be a <code>HttpURLConnection</code>, but because I'll be using the Apache Commons HTTP library, I changed it to a <code>HttpRequest</code> object. Now, I'm getting errors when I call <code>connect()</code>, <code>getResponseCode()</code>, and <code>getResponseMessage()</code>, because those functions are for a <code>HttpURLConnection</code>. What functions from <code>HttpRequest</code> would I use so I can get the code to compile and run correctly? Thanks!</p>