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 Details

    • JettyClientHttpRequestFactory

      public JettyClientHttpRequestFactory()
      Default constructor that creates a new instance of HttpClient.
    • JettyClientHttpRequestFactory

      public JettyClientHttpRequestFactory(org.eclipse.jetty.client.HttpClient httpClient)
      Constructor that takes a customized HttpClient instance.
      Parameters:
      httpClient - the
  • Method Details

    • setTimeOut

      public void setTimeOut(Duration timeOut)
      Sets the maximum time to wait until all headers have been received. The default value is 1 second.
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Description copied from interface: InitializingBean
      Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, ApplicationContextAware etc.

      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:
      afterPropertiesSet in 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
    • destroy

      public void destroy() throws Exception
      Description copied from interface: DisposableBean
      Invoked by the containing BeanFactory on destruction of a bean.
      Specified by:
      destroy in 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.
    • createRequest

      public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException
      Description copied from interface: ClientHttpRequestFactory
      Create a new ClientHttpRequest for the specified URI and HTTP method.

      The returned request can be written to, and then executed by calling ClientHttpRequest.execute().

      Specified by:
      createRequest in 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