title: How does one set Default HttpHost Target in Apache HttpClient 4.3+?
body: <p>In Apache HttpClient 4.2 one could create a <code>DefaultHttpClient</code> and set a host such that those making an <code>execute</code> call would not have to provide the host information in the input request URI, i.e.:</p>
  
  <pre><code>HttpHost targetHost = new HttpHost(host, port, secure ? "https" : "http");      
  DefaultHttpClient defaultHttp = new DefaultHttpClient(connectionManager);
  defaultHttp.getParams().setParameter(ClientPNames.DEFAULT_HOST, targetHost);
  </code></pre>
  
  <p>I do admit this strategy appears very awkward, I inherited this code :).  I'm sure there's an even better way to do this in 4.2.</p>
  
  <p>I'm looking to upgrade to 4.3 and noticed that <code>DefaultHttpClient</code> and <code>ClientPNames</code> are now both deprecated in favor of <code>HttpClientBuilder</code> and <code>RequestConfig</code> respectively.  However I can find no such way to define a default target with <code>RequestConfig</code>.</p>
  
  <p><a href="http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/client/CloseableHttpClient.html#execute%28org.apache.http.HttpHost,%20org.apache.http.HttpRequest%29" rel="nofollow">Documentation</a> for execute does reference that that input target parameter can accept null, so I'm sure there is still a way to facilitate this, but I'm struggling to figure this out:</p>
  
  <blockquote>
    <p>target - the target host for the request. Implementations may accept null if they can still determine a route, for example to a default target or by inspecting the request.</p>
  </blockquote>