Class JettyClientHttpRequestFactory
java.lang.Object
org.springframework.http.client.JettyClientHttpRequestFactory
- All Implemented Interfaces:
- DisposableBean,- InitializingBean,- ClientHttpRequestFactory
public class JettyClientHttpRequestFactory
extends Object
implements ClientHttpRequestFactory, InitializingBean, DisposableBean
ClientHttpRequestFactory implementation based on Jetty's HttpClient.- Since:
- 6.1
- Author:
- Arjen Poutsma
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionDefault constructor that creates a new instance ofHttpClient.JettyClientHttpRequestFactory(org.eclipse.jetty.client.HttpClient httpClient) Constructor that takes a customizedHttpClientinstance.
- 
Method SummaryModifier and TypeMethodDescriptionvoidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.createRequest(URI uri, HttpMethod httpMethod) Create a newClientHttpRequestfor the specified URI and HTTP method.voiddestroy()Invoked by the containingBeanFactoryon destruction of a bean.voidsetConnectTimeout(int connectTimeout) Set the underlying connect timeout in milliseconds.voidsetConnectTimeout(Duration connectTimeout) Set the underlying connect timeout in milliseconds.voidsetReadTimeout(long readTimeout) Set the underlying read timeout in milliseconds.voidsetReadTimeout(Duration readTimeout) Set the underlying read timeout asDuration.
- 
Constructor Details- 
JettyClientHttpRequestFactorypublic JettyClientHttpRequestFactory()Default constructor that creates a new instance ofHttpClient.
- 
JettyClientHttpRequestFactorypublic JettyClientHttpRequestFactory(org.eclipse.jetty.client.HttpClient httpClient) Constructor that takes a customizedHttpClientinstance.- Parameters:
- httpClient- the
 
 
- 
- 
Method Details- 
setConnectTimeoutpublic void setConnectTimeout(int connectTimeout) Set the underlying connect timeout in milliseconds. A value of 0 specifies an infinite timeout.Default is 5 seconds. 
- 
setConnectTimeoutSet the underlying connect timeout in milliseconds. A value of 0 specifies an infinite timeout.Default is 5 seconds. 
- 
setReadTimeoutpublic void setReadTimeout(long readTimeout) Set the underlying read timeout in milliseconds.Default is 10 seconds. 
- 
setReadTimeoutSet the underlying read timeout asDuration.Default is 10 seconds. 
- 
afterPropertiesSetDescription copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. - Specified by:
- afterPropertiesSetin interface- InitializingBean
- Throws:
- Exception- in the event of misconfiguration (such as failure to set an essential property) or if initialization fails for any other reason
 
- 
destroyDescription copied from interface:DisposableBeanInvoked by the containingBeanFactoryon destruction of a bean.- Specified by:
- destroyin interface- DisposableBean
- Throws:
- Exception- in case of shutdown errors. Exceptions will get logged but not rethrown to allow other beans to release their resources as well.
 
- 
createRequestDescription copied from interface:ClientHttpRequestFactoryCreate a newClientHttpRequestfor the specified URI and HTTP method.The returned request can be written to, and then executed by calling ClientHttpRequest.execute().- Specified by:
- createRequestin interface- ClientHttpRequestFactory
- Parameters:
- uri- the URI to create a request for
- httpMethod- the HTTP method to execute
- Returns:
- the created request
- Throws:
- IOException- in case of I/O errors
 
 
-