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 Summary
ConstructorsConstructorDescriptionDefaultClientRequestFactory(@NotNull OutboundHttpClientFactory factory) Instantiates this request factory. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears internal state.protected voidconfigureFactory(org.springframework.http.client.ClientHttpRequestFactory f) Configures the factory instance created bycreateRealFactory()method, if the configuration was injected into this class.protected org.springframework.http.client.ClientHttpRequestFactoryCreates a request factory implementation to delegate the request creation to.org.springframework.http.client.ClientHttpRequestcreateRequest(URI uri, org.springframework.http.HttpMethod httpMethod) voidInjects configuration to be used for creating the requests.
-
Constructor Details
-
DefaultClientRequestFactory
Instantiates this request factory.- Parameters:
factory- a factory to createHttpClientinstances 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:
createRequestin interfaceorg.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 theconfigureFactory(ClientHttpRequestFactory)method too.
-
configureFactory
protected void configureFactory(org.springframework.http.client.ClientHttpRequestFactory f) Configures the factory instance created bycreateRealFactory()method, if the configuration was injected into this class.- Parameters:
f- a factory implementation to configure- See Also:
-
setConfiguration
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.
-