Code example for HttpGet

Methods: addHeader

0
   * @throws ClientProtocolException 
   * @throws IOException 
   */ 
  public static ReadableResponse signedGetRequest(String request, CommonsHttpOAuthConsumer consumer, String contentType) throws OAuthMessageSignerException, OAuthExpectationFailedException, OAuthCommunicationException, ClientProtocolException, IOException{
    HttpClient client = new DefaultHttpClient();
    HttpGet get = new HttpGet(request);
    consumer.sign(get);
    get.addHeader("Content-Type", contentType);
    HttpResponse response = client.execute(get);
    return new HttpResponseWrapper(response);
  } 
   
  /** 
   * Sends a GET request 
   * @param request the endpoint's URL 
   * @return the response 
   * @throws ClientProtocolException 
   * @throws IOException 
   */ 
  public static ReadableResponse unsignedGetRequest(String request) throws ClientProtocolException, IOException{
    HttpClient client = new DefaultHttpClient();