Class DefaultClientRequestFactory

java.lang.Object
de.hybris.platform.outboundservices.client.impl.DefaultClientRequestFactory
All Implemented Interfaces:
org.springframework.http.client.ClientHttpRequestFactory

public class DefaultClientRequestFactory extends Object implements org.springframework.http.client.ClientHttpRequestFactory
Default implementation of ClientHttpRequestFactory in the outboundservices. This implementation lazily creates HttpClients per each request destination. Two destinations are the same, if they have equal host, and such destinations will share the HttpClient and the connection pool, if the client uses a connection pool manager.
See Also:
  • Constructor Details

    • DefaultClientRequestFactory

      public DefaultClientRequestFactory(@NotNull @NotNull OutboundHttpClientFactory factory)
      Instantiates this request factory.
      Parameters:
      factory - a factory to create HttpClient instances to be used by the requests.
  • Method Details

    • createRequest

      @Nonnull public org.springframework.http.client.ClientHttpRequest createRequest(@Nonnull URI uri, @Nonnull org.springframework.http.HttpMethod httpMethod) throws IOException
      Specified by:
      createRequest in interface org.springframework.http.client.ClientHttpRequestFactory
      Throws:
      IOException
    • createRealFactory

      protected org.springframework.http.client.ClientHttpRequestFactory createRealFactory()
      Creates a request factory implementation to delegate the request creation to. This is a real factory that creates requests.
      Returns:
      a factory instance to use for request creation. Note: this implementation returns HttpComponentsClientHttpRequestFactory. If a subclass overrides this method and returns a different implementation, then it should override the configureFactory(ClientHttpRequestFactory) method too.
    • configureFactory

      protected void configureFactory(org.springframework.http.client.ClientHttpRequestFactory f)
      Configures the factory instance created by createRealFactory() method, if the configuration was injected into this class.
      Parameters:
      f - a factory implementation to configure
      See Also:
    • setConfiguration

      public void setConfiguration(OutboundServicesConfiguration cfg)
      Injects configuration to be used for creating the requests. If the configuration is not provided, then the request factory won't be configured and will use default values.
      Parameters:
      cfg - configuration service implementation specifying the request parameters.
    • clear

      public void clear()
      Clears internal state. The call to this method is useful to apply configuration changes to the future HTTP requests.