HttpClients.createSystem() 与 HttpClients.createDefault() 之间的区别?
Difference between HttpClients.createSystem() vs HttpClients.createDefault()?
我正在查看在 org.apache.http.impl.client.HttpClients
中创建 ClosableHttpClient 的方法,我看到了两种可能的方法:
.createDefault()
: 使用默认配置创建 CloseableHttpClient 实例
.createSystem()
: 根据系统属性使用默认配置创建 CloseableHttpClient 实例。
两者有什么区别?我知道 it is possible to set up a custom client with .custom()
to override certain behaviors 但是我剩下的问题是:
- 与
.createDefault()
关联的默认值是什么?
- 哪些系统属性会影响
.createSystem()
?
- 是否可以修改使用
.createDefault()
或 .createDefault()
创建的未来客户端的行为?
由于历史原因(可追溯到 200 年代早期)HttpClient 默认不考虑系统属性。
What are the defaults associated with .createDefault()?
这些是 HttpClient 开发人员选择的项目默认值
What system properties affect .createSystem()?
- ssl.TrustManagerFactory.algorithm
- javax.net.ssl.trustStoreType
- javax.net.ssl.trustStore
- javax.net.ssl.trustStore提供商
- javax.net.ssl.trustStore密码
- ssl.KeyManagerFactory.algorithm
- javax.net.ssl.keyStoreType
- javax.net.ssl.keyStore
- javax.net.ssl.keyStore提供商
- javax.net.ssl.keyStore密码
- https.protocols
- https.cipherSuites
- http.proxyHost
- http.proxyPort
- https.proxyHost
- https.proxyPort
- http.nonProxyHosts
- https.proxyUser
- http.proxyUser
- https.proxyPassword
- http.proxyPassword
- http.keepAlive
- http.maxConnections
- http.agent
Is it possible to modify the behavior of future clients that are created with .createDefault() or .createDefault()?
当然,通过HttpContext
我正在查看在 org.apache.http.impl.client.HttpClients
中创建 ClosableHttpClient 的方法,我看到了两种可能的方法:
.createDefault()
: 使用默认配置创建 CloseableHttpClient 实例.createSystem()
: 根据系统属性使用默认配置创建 CloseableHttpClient 实例。
两者有什么区别?我知道 it is possible to set up a custom client with .custom()
to override certain behaviors 但是我剩下的问题是:
- 与
.createDefault()
关联的默认值是什么? - 哪些系统属性会影响
.createSystem()
? - 是否可以修改使用
.createDefault()
或.createDefault()
创建的未来客户端的行为?
由于历史原因(可追溯到 200 年代早期)HttpClient 默认不考虑系统属性。
What are the defaults associated with .createDefault()?
这些是 HttpClient 开发人员选择的项目默认值
What system properties affect .createSystem()?
- ssl.TrustManagerFactory.algorithm
- javax.net.ssl.trustStoreType
- javax.net.ssl.trustStore
- javax.net.ssl.trustStore提供商
- javax.net.ssl.trustStore密码
- ssl.KeyManagerFactory.algorithm
- javax.net.ssl.keyStoreType
- javax.net.ssl.keyStore
- javax.net.ssl.keyStore提供商
- javax.net.ssl.keyStore密码
- https.protocols
- https.cipherSuites
- http.proxyHost
- http.proxyPort
- https.proxyHost
- https.proxyPort
- http.nonProxyHosts
- https.proxyUser
- http.proxyUser
- https.proxyPassword
- http.proxyPassword
- http.keepAlive
- http.maxConnections
- http.agent
Is it possible to modify the behavior of future clients that are created with .createDefault() or .createDefault()?
当然,通过HttpContext