|
|
|
@ -62,6 +62,14 @@ public class HttpClientGenerator {
|
|
|
|
|
new UsernamePasswordCredentials(proxy.getUser(), proxy.getPassword()));
|
|
|
|
|
httpClientBuilder.setDefaultCredentialsProvider(credsProvider);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(site!=null&&site.getHttpProxy()!=null&&site.getUsernamePasswordCredentials()!=null){
|
|
|
|
|
credsProvider = new BasicCredentialsProvider();
|
|
|
|
|
credsProvider.setCredentials(
|
|
|
|
|
new AuthScope(site.getHttpProxy()),//可以访问的范围
|
|
|
|
|
site.getUsernamePasswordCredentials());//用户名和密码
|
|
|
|
|
httpClientBuilder.setDefaultCredentialsProvider(credsProvider);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
httpClientBuilder.setConnectionManager(connectionManager);
|
|
|
|
|
if (site != null && site.getUserAgent() != null) {
|
|
|
|
@ -82,13 +90,6 @@ public class HttpClientGenerator {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(site!=null&&site.getHttpProxy()!=null&&site.getUsernamePasswordCredentials()!=null){
|
|
|
|
|
CredentialsProvider credsProvider = new BasicCredentialsProvider();
|
|
|
|
|
credsProvider.setCredentials(
|
|
|
|
|
new AuthScope(site.getHttpProxy()),//可以访问的范围
|
|
|
|
|
site.getUsernamePasswordCredentials());//用户名和密码
|
|
|
|
|
httpClientBuilder.setDefaultCredentialsProvider(credsProvider);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SocketConfig socketConfig = SocketConfig.custom().setSoKeepAlive(true).setTcpNoDelay(true).build();
|
|
|
|
|
httpClientBuilder.setDefaultSocketConfig(socketConfig);
|
|
|
|
|