2017-02-16 41 views
1

我正在使用以下代碼來發出Http請求。將setDefaultRequestConfig方法覆蓋系統屬性 - CloseableHttpClient

RequestConfig requestConfig = RequestConfig.custom() 
       .setConnectTimeout(10000) 
       .setConnectionRequestTimeout(10000) 
       .setSocketTimeout(300000) 
       .build(); 
CloseableHttpClient httpClient = HttpClientBuilder.create().useSystemProperties().setDefaultRequestConfig(requestConfig).build(); 

我簡單的問題,將在方法setDefaultRequestConfig刪除所有的系統屬性,將只保留上面給出的屬性或將只覆蓋給定的性能,並保持其他系統性能,同時使HTTP請求。是

回答

1

該HttpClientBuilder可任選考慮系統性能如下

  • ssl.TrustManagerFactory.algorithm
  • javax.net.ssl.trustStoreType
  • javax.net.ssl.trustStore中
  • javax.net.ssl.trustStoreProvider
  • javax.net.ssl.trustStorePassword
  • ssl.KeyManagerFactory.a lgorithm
  • javax.net.ssl.keyStoreType
  • javax.net.ssl.keyStore
  • javax.net.ssl.keyStoreProvider
  • javax.net.ssl.keyStorePassword
  • https.protocols
  • https.cipherSuites
  • http.proxyHost
  • 把http.proxyPort
  • http.nonProxyHosts
  • http.keepAlive
  • http.maxConnections
  • http.agent

請求級別的配置與代理主機和端口的異常對任何這些設置沒有影響。請求級別的代理設置將覆蓋系統級別的代理設置。