public class HttpPipelineBuilder extends Object
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
new HttpPipelineBuilder()
.build();
Create a pipeline using the default HTTP client and a retry policy
new HttpPipelineBuilder()
.httpClient(HttpClient.createDefault())
.policies(new RetryPolicy())
.build();
HttpPipeline| Constructor and Description |
|---|
HttpPipelineBuilder()
Creates a new instance of HttpPipelineBuilder that can configure options for the
HttpPipeline before
creating an instance of it. |
| Modifier and Type | Method and Description |
|---|---|
HttpPipeline |
build()
Creates a
HttpPipeline based on options set in the Builder. |
HttpPipelineBuilder |
httpClient(HttpClient httpClient)
Sets the HttpClient that the pipeline will use to send requests.
|
HttpPipelineBuilder |
policies(HttpPipelinePolicy... policies)
Adds
policies to the set of policies that the pipeline will use
when sending requests. |
public HttpPipelineBuilder()
HttpPipeline before
creating an instance of it.public HttpPipeline build()
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 the default HttpClient is used.public HttpPipelineBuilder httpClient(HttpClient httpClient)
httpClient - The HttpClient the pipeline will use when sending requests.public HttpPipelineBuilder policies(HttpPipelinePolicy... policies)
policies to the set of policies that the pipeline will use
when sending requests.policies - Policies to add to the policy set.Copyright © 2020 Microsoft Corporation. All rights reserved.