Class HttpComponents5ClientFactory
java.lang.Object
org.springframework.ws.transport.http.HttpComponents5ClientFactory
- All Implemented Interfaces:
- org.springframework.beans.factory.FactoryBean<org.apache.hc.client5.http.impl.classic.CloseableHttpClient>
public class HttpComponents5ClientFactory
extends Object
implements org.springframework.beans.factory.FactoryBean<org.apache.hc.client5.http.impl.classic.CloseableHttpClient>
FactoryBean to set up a CloseableHttpClient using HttpComponents HttpClient 5.- Since:
- 4.0.5
- Author:
- Lars Uffmann
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final org.apache.hc.client5.http.auth.AuthScopeAuthScopeto match any Host.Fields inherited from interface org.springframework.beans.factory.FactoryBeanOBJECT_TYPE_ATTRIBUTE
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionorg.apache.hc.client5.http.impl.classic.CloseableHttpClientClass<?>booleanvoidsetAuthScope(org.apache.hc.client5.http.auth.AuthScope authScope) Sets the authentication scope to be used.voidsetClientBuilderCustomizer(HttpComponents5ClientFactory.HttpClientBuilderCustomizer clientBuilderCustomizer) voidsetConnectionManagerBuilderCustomizer(HttpComponents5ClientFactory.PoolingHttpClientConnectionManagerBuilderCustomizer connectionManagerBuilderCustomizer) voidsetConnectionTimeout(Duration timeout) Sets the timeout until a connection is established.voidsetCredentials(org.apache.hc.client5.http.auth.Credentials credentials) Sets the credentials to be used.voidsetMaxConnectionsPerHost(Map<String, String> maxConnectionsPerHost) Sets the maximum number of connections per host for the underlying HttpClient.voidsetMaxTotalConnections(int maxTotalConnections) Sets the maximum number of connections allowed for the underlying HttpClient.voidsetReadTimeout(Duration timeout) Set the socket read timeout for the underlying HttpClient.
- 
Field Details- 
ANYpublic static final org.apache.hc.client5.http.auth.AuthScope ANYAuthScopeto match any Host.NOTE: ANYwas removed fromAuthScopein HttpComponents 5.0. This value object will easy migration from HttpComponents 4. Consider using aClientInterceptorto implement http client agnostic preemptive basic auth.- See Also:
- 
- AuthScope(String, String, int, String, String)
 
 
 
- 
- 
Constructor Details- 
HttpComponents5ClientFactorypublic HttpComponents5ClientFactory()
 
- 
- 
Method Details- 
setCredentialspublic void setCredentials(org.apache.hc.client5.http.auth.Credentials credentials) Sets the credentials to be used. If not set, no authentication is done.- See Also:
- 
- UsernamePasswordCredentials
- NTCredentials
 
 
- 
setAuthScopepublic void setAuthScope(org.apache.hc.client5.http.auth.AuthScope authScope) Sets the authentication scope to be used. Only used when thecredentialsproperty has been set.By default, ANYis used.- See Also:
 
- 
setConnectionTimeoutSets the timeout until a connection is established. A value of 0 means never timeout.- Parameters:
- timeout- the timeout value
 
- 
setReadTimeoutSet the socket read timeout for the underlying HttpClient. A value of 0 means never timeout.- Parameters:
- timeout- the timeout value
 
- 
setMaxTotalConnectionspublic void setMaxTotalConnections(int maxTotalConnections) Sets the maximum number of connections allowed for the underlying HttpClient.- Parameters:
- maxTotalConnections- the maximum number of connections allowed
 
- 
setMaxConnectionsPerHostSets the maximum number of connections per host for the underlying HttpClient. The maximum number of connections per host can be set in a form accepted by thejava.util.Propertiesclass, like as follows:https://www.example.com=1 http://www.example.com:8080=7 http://www.springframework.org=10 The host can be specified as a URI (with scheme and port). - Parameters:
- maxConnectionsPerHost- a properties object specifying the maximum number of connection
 
- 
isSingletonpublic boolean isSingleton()- Specified by:
- isSingletonin interface- org.springframework.beans.factory.FactoryBean<org.apache.hc.client5.http.impl.classic.CloseableHttpClient>
 
- 
getObject- Specified by:
- getObjectin interface- org.springframework.beans.factory.FactoryBean<org.apache.hc.client5.http.impl.classic.CloseableHttpClient>
- Throws:
- Exception
 
- 
getObjectType- Specified by:
- getObjectTypein interface- org.springframework.beans.factory.FactoryBean<org.apache.hc.client5.http.impl.classic.CloseableHttpClient>
 
- 
setClientBuilderCustomizerpublic void setClientBuilderCustomizer(HttpComponents5ClientFactory.HttpClientBuilderCustomizer clientBuilderCustomizer) 
- 
setConnectionManagerBuilderCustomizerpublic void setConnectionManagerBuilderCustomizer(HttpComponents5ClientFactory.PoolingHttpClientConnectionManagerBuilderCustomizer connectionManagerBuilderCustomizer) 
 
-