Package com.adobe.acs.commons.http
Interface HttpClientFactory
public interface HttpClientFactory
Factory for building pre-configured HttpClient Fluent
Executor and Request objects
based on a configured host, port and (optionally) username/password.
Each OSGi configuration with factory PID com.adobe.acs.commons.http.impl.HttpClientFactoryImpl exposes one service of this kind.
The individual factories will generally be accessed by service lookup using the factory.name property.
Despite the name each instance of this interface only holds a single Executor instance (bound to a single HttpClient).-
Method Summary
Modifier and TypeMethodDescriptionvoidCustomizes the underlyingHttpClientBuilderwhich is used to create the singleton http client and executororg.apache.http.client.fluent.RequestCreate a DELETE request using the base hostname and port defined in the factory configuration.org.apache.http.client.fluent.RequestCreate a GET request using the base hostname and port defined in the factory configuration.org.apache.http.client.fluent.ExecutorGet the singletonExecutorobject.org.apache.http.client.fluent.RequestCreate a OPTIONS request using the base hostname and port defined in the factory configuration.org.apache.http.client.fluent.RequestCreate a POST request using the base hostname and port defined in the factory configuration.org.apache.http.client.fluent.RequestCreate a PUT request using the base hostname and port defined in the factory configuration.
-
Method Details
-
customize
Customizes the underlyingHttpClientBuilderwhich is used to create the singleton http client and executor- Parameters:
builderCustomizer- aConsumertaking theHttpClientBuilderinitialized with the configured basic options.- Throws:
IllegalStateException- in casegetExecutor()has been called already- Since:
- 2.1.0 (Bundle version 6.4.0)
-
getExecutor
org.apache.http.client.fluent.Executor getExecutor()Get the singletonExecutorobject.- Returns:
- the executor
-
get
Create a GET request using the base hostname and port defined in the factory configuration.- Parameters:
partialUrl- the portion of the URL after the port (and slash)- Returns:
- a fluent Request object
-
put
Create a PUT request using the base hostname and port defined in the factory configuration.- Parameters:
partialUrl- the portion of the URL after the port (and slash)- Returns:
- a fluent Request object
-
post
Create a POST request using the base hostname and port defined in the factory configuration.- Parameters:
partialUrl- the portion of the URL after the port (and slash)- Returns:
- a fluent Request object
-
delete
Create a DELETE request using the base hostname and port defined in the factory configuration.- Parameters:
partialUrl- the portion of the URL after the port (and slash)- Returns:
- a fluent Request object
-
options
Create a OPTIONS request using the base hostname and port defined in the factory configuration.- Parameters:
partialUrl- the portion of the URL after the port (and slash)- Returns:
- a fluent Request object
-