public final class HttpPipelineBuilder extends Object
| Constructor and Description |
|---|
HttpPipelineBuilder()
Create a new HttpPipeline builder.
|
HttpPipelineBuilder(HttpPipelineOptions options)
Create a new HttpPipeline builder.
|
| Modifier and Type | Method and Description |
|---|---|
HttpPipeline |
build()
Create a new HttpPipeline from the RequestPolicy factories that have been added to this
HttpPipeline builder.
|
HttpPipelineBuilder |
withCookiePolicy()
Add a RequestPolicy which stores and adds cookies across multiple
requests and responses.
|
HttpPipelineBuilder |
withCredentialsPolicy(ServiceClientCredentials credentials)
Add a RequestPolicy which applies the given ServiceClientCredentials to
outgoing requests.
|
HttpPipelineBuilder |
withDecodingPolicy()
Adds a RequestPolicy which decodes the headers and body of incoming
responses.
|
HttpPipelineBuilder |
withHostPolicy(String host)
Adds a RequestPolicy which sets the host on all outgoing requests.
|
HttpPipelineBuilder |
withHttpClient(HttpClient httpClient)
Set the HttpClient that will be used by HttpPipelines that are created by this Builder.
|
HttpPipelineBuilder |
withHttpLoggingPolicy(HttpLogDetailLevel level)
Adds a RequestPolicy which logs all HTTP traffic using SLF4J.
|
HttpPipelineBuilder |
withHttpLoggingPolicy(HttpLogDetailLevel level,
boolean prettyPrintJSON)
Adds a RequestPolicy which logs all HTTP traffic using SLF4J.
|
HttpPipelineBuilder |
withLogger(HttpPipelineLogger logger)
Set the Logger that will be used for each RequestPolicy within the created HttpPipeline.
|
HttpPipelineBuilder |
withProxyAuthenticationPolicy(String username,
String password)
Adds a RequestPolicy which adds proxy authentication headers to
outgoing requests.
|
HttpPipelineBuilder |
withRequestIdPolicy()
Adds a RequestPolicy which adds a per-request ID to the
"x-ms-client-request-id" header to outgoing requests.
|
HttpPipelineBuilder |
withRequestPolicies(RequestPolicyFactory... requestPolicyFactories)
Add the provided RequestPolicy factories to this HttpPipeline builder.
|
HttpPipelineBuilder |
withRequestPolicy(int index,
RequestPolicyFactory requestPolicyFactory)
Add the provided RequestPolicy factory to this HttpPipeline builder
at the provided index in the pipeline.
|
HttpPipelineBuilder |
withRequestPolicy(RequestPolicyFactory requestPolicyFactory)
Add the provided RequestPolicy factory to this HttpPipeline builder.
|
HttpPipelineBuilder |
withRetryPolicy(int maxRetries,
long delayTime,
TimeUnit timeUnit)
Adds a RequestPolicy which retries a failed request up to the given
number of times.
|
HttpPipelineBuilder |
withTimeoutPolicy(long timeout,
TimeUnit unit)
Adds a RequestPolicy which fails a request if it does not complete by
the time the given interval elapses.
|
HttpPipelineBuilder |
withUserAgentPolicy(String userAgent)
Add a RequestPolicy that will add the provided UserAgent header to each
outgoing HttpRequest.
|
public HttpPipelineBuilder()
public HttpPipelineBuilder(HttpPipelineOptions options)
options - The optional properties that will be set on the created HTTP pipelines.public HttpPipelineBuilder withHttpClient(HttpClient httpClient)
httpClient - The HttpClient to use.public HttpPipelineBuilder withLogger(HttpPipelineLogger logger)
logger - The Logger to provide to each RequestPolicy.public HttpPipelineBuilder withRequestPolicy(RequestPolicyFactory requestPolicyFactory)
requestPolicyFactory - The RequestPolicy factory to add to this HttpPipeline builder.public HttpPipelineBuilder withRequestPolicy(int index, RequestPolicyFactory requestPolicyFactory)
index - The index to insert the provided RequestPolicy factory.requestPolicyFactory - The RequestPolicy factory to add to this
HttpPipeline builder.public HttpPipelineBuilder withRequestPolicies(RequestPolicyFactory... requestPolicyFactories)
requestPolicyFactories - The RequestPolicy factories to add to this
HttpPipeline builder.public HttpPipelineBuilder withCookiePolicy()
public HttpPipelineBuilder withCredentialsPolicy(ServiceClientCredentials credentials)
credentials - The credentials to apply to requests.public HttpPipelineBuilder withDecodingPolicy()
public HttpPipelineBuilder withHostPolicy(String host)
host - The hostname to use in all outgoing requests.public HttpPipelineBuilder withHttpLoggingPolicy(HttpLogDetailLevel level)
level - The HTTP logging detail level.public HttpPipelineBuilder withHttpLoggingPolicy(HttpLogDetailLevel level, boolean prettyPrintJSON)
level - The HTTP logging detail level.prettyPrintJSON - Whether or not to pretty print JSON message bodies.public HttpPipelineBuilder withProxyAuthenticationPolicy(String username, String password)
username - The username for authentication.password - The password for authentication.public HttpPipelineBuilder withRequestIdPolicy()
public HttpPipelineBuilder withRetryPolicy(int maxRetries, long delayTime, TimeUnit timeUnit)
maxRetries - The maximum number of times to retry failed requests.delayTime - the delay between retriestimeUnit - the time unit of the delaypublic HttpPipelineBuilder withTimeoutPolicy(long timeout, TimeUnit unit)
timeout - The amount of time to wait before timing out a request.unit - The unit of time associated with the timeout parameter.public HttpPipelineBuilder withUserAgentPolicy(String userAgent)
userAgent - The userAgent header value to add to each outgoing HttpRequest.public HttpPipeline build()
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/