如何在CloseableHttpClient对象上设置HostConfiguration。较早时,我曾经使用Commons httpclient
myHttpClient.getHostConfiguration().setHost( host, port, baseHttps )
Apache HttpComponents项目中的等效项是什么?
答案 0 :(得分:0)
请参考以下代码:
URI uri = new URI(myURIString);
HttpClientContext context = HttpClientContext.create();
HttpRoute route = new HttpRoute(new HttpHost(host,uri.getPort(),uri.getScheme()));