HttpPipelineBuilder Class
- java.
lang. Object - com.
azure. core. http. HttpPipelineBuilder
- com.
public class HttpPipelineBuilder
This class provides a fluent builder API to help aid the configuration and instantiation of the HttpPipeline, calling build() constructs an instance of the pipeline.
A pipeline is configured with a HttpClient that sends the request, if no client is set a default is used. A pipeline may be configured with a list of policies that are applied to each request.
Code Samples
Create a pipeline without configuration
HttpPipeline pipeline = new HttpPipelineBuilder().build();
Create a pipeline using the default HTTP client and a retry policy
HttpPipeline pipeline = new HttpPipelineBuilder()
.httpClient(HttpClient.createDefault())
.policies(new RetryPolicy())
.build();
Constructor Summary
| Constructor | Description |
|---|---|
| HttpPipelineBuilder() |
Creates a new instance of Http |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
Http |
build()
Creates an HttpPipeline based on options set in the builder. |
|
Http |
clientOptions(ClientOptions clientOptions)
Sets the Client |
|
Http |
httpClient(HttpClient httpClient)
Sets the Http |
|
Http |
policies(HttpPipelinePolicy[] policies)
Adds HttpPipelinePolicy to the set of policies that the pipeline will use when sending requests. |
|
Http |
tracer(Tracer tracer)
Sets the Tracer to trace logical and HTTP calls. |
Methods inherited from java.lang.Object
Constructor Details
HttpPipelineBuilder
public HttpPipelineBuilder()
Creates a new instance of HttpPipelineBuilder that can configure options for the HttpPipeline before creating an instance of it.
Method Details
build
public HttpPipeline build()
Creates an HttpPipeline based on options set in the builder. Every time build() is called, a new instance of HttpPipeline is created.
If HttpClient is not set then a default HttpClient is used.
Returns:
clientOptions
public HttpPipelineBuilder clientOptions(ClientOptions clientOptions)
Sets the ClientOptions that will configure the pipeline.
Parameters:
Returns:
httpClient
public HttpPipelineBuilder httpClient(HttpClient httpClient)
Sets the HttpClient that the pipeline will use to send requests.
Parameters:
Returns:
policies
public HttpPipelineBuilder policies(HttpPipelinePolicy[] policies)
Adds HttpPipelinePolicy to the set of policies that the pipeline will use when sending requests.
Parameters:
Returns:
tracer
public HttpPipelineBuilder tracer(Tracer tracer)
Sets the Tracer to trace logical and HTTP calls.
Parameters:
Returns: