title: Is it possible to get both the status code and the body content when using Apache HttpClient's Facade?
body: <p>I am using <a href="http://hc.apache.org/httpcomponents-client-4.3.x/tutorial/html/fluent.html#d5e834" rel="noreferrer">Apache's HttpClient Fluent Facade in Java</a> in some sample code for developers to extend.  They really like the fluent facade, with its capability to just call:</p>
  
  <pre><code>this.body = Request.Get(uri.build()).execute().returnContent().asString();
  </code></pre>
  
  <p>Additionally, I could get the status code by callling:</p>
  
  <pre><code>this.statusCode = Request.Get(uri.build()).execute().returnResponse().getStatusLine().getStatusCode();
  </code></pre>
  
  <p>Unfortunately, there are several instances where I need the status code in addition to the body.  Based on <a href="https://stackoverflow.com/questions/14024625/how-to-get-httpclient-returning-status-code-and-response-body">this question</a>, I see that I could have them learn the HttpClient object -</p>
  
  <pre><code>HttpResponse response = client.execute(httpGet);
  String body = handler.handleResponse(response);
  int code = response.getStatusLine().getStatusCode();
  </code></pre>
  
  <p>but, that means initializing the HttpClient object and seemingly rejecting the Fluent interface and the Request.Get (or Post) syntax.  Is there a way to get both the status code and the body <em>without</em> losing the Fluent syntax and without making two discrete calls?</p>