Package com.azure.core.http.policy
package com.azure.core.http.policy
This package contains the HttpPipelinePolicy interface and its implementations. These policies are used to form an
HTTP pipeline, which is a series of policies that are invoked to handle an HTTP request.
The HttpPipelinePolicy interface defines process and processSync methods. These methods transform an HTTP request into an HttpResponse asynchronously and synchronously respectively. Implementations of this interface can modify the request, pass it to the next policy, and then modify the response.
Code Sample:
In this example, the UserAgentPolicy, RetryPolicy, and CustomPolicy are added to the pipeline. The pipeline is then used to send an HTTP request, and the response is retrieved.
HttpPipeline pipeline = new HttpPipelineBuilder()
.policies(new UserAgentPolicy(), new RetryPolicy(), new CustomPolicy())
.build();
HttpRequest request = new HttpRequest(HttpMethod.GET, new URL("http://example.com"));
HttpResponse response = pipeline.send(request).block();
This package is crucial for the communication between Azure SDK client libraries and Azure services. It provides a layer of abstraction over the HTTP protocol, allowing client libraries to focus on service-specific logic.
- See Also:
-
ClassDescriptionThe
AddDatePolicyclass is an implementation of theHttpPipelinePolicyinterface.The pipeline policy that override or addHttpHeadersinHttpRequestby reading values fromContextwith key 'azure-http-headers-key'.TheAddHeadersPolicyclass is an implementation of theHttpPipelinePolicyinterface.Implementing classes are automatically added as policies after the retry policy.TheAzureKeyCredentialPolicyclass is an implementation of theKeyCredentialPolicyinterface.TheAzureSasCredentialPolicyclass is an implementation of theHttpPipelinePolicyinterface.TheBearerTokenAuthenticationPolicyclass is an implementation of theHttpPipelinePolicyinterface.Implementing classes are automatically added as policies before the retry policy.TheCookiePolicyclass is an implementation of theHttpPipelinePolicyinterface.TheDefaultRedirectStrategyclass is an implementation of theRedirectStrategyinterface.TheExponentialBackoffclass is an implementation of theRetryStrategyinterface.TheExponentialBackoffOptionsclass provides configuration options for theExponentialBackoffretry strategy.TheFixedDelayclass is an implementation of theRetryStrategyinterface.TheFixedDelayOptionsclass provides configuration options for theFixedDelayretry strategy.TheHostPolicyclass is an implementation of theHttpPipelinePolicyinterface.TheHttpLogDetailLevelclass is an enumeration of the levels of detail to log on HTTP messages.TheHttpLoggingPolicyclass is an implementation of theHttpPipelinePolicyinterface.TheHttpLogOptionsclass provides configuration options for HTTP logging.A policy within theHttpPipeline.TheHttpPipelineSyncPolicyclass is an implementation of theHttpPipelinePolicyinterface.Implementing classes automatically provide policies.TheHttpPolicyProvidersclass is responsible for adding Service Provider Interface (SPI) pluggable policies to an HTTP pipeline automatically.Manages logging HTTP requests inHttpLoggingPolicy.TheHttpRequestLoggingContextclass provides contextual information available during HTTP request logging.Manages logging HTTP responses inHttpLoggingPolicy.TheHttpResponseLoggingContextclass provides contextual information available during HTTP response logging.TheKeyCredentialPolicyclass is an implementation of theHttpPipelinePolicyinterface.ThePortPolicyclass is an implementation of theHttpPipelinePolicyinterface.TheProtocolPolicyclass is an implementation of theHttpPipelinePolicyinterface.TheRedirectPolicyclass is an implementation of theHttpPipelinePolicyinterface.The interface for determining theredirect strategyused inRedirectPolicy.TheRequestIdPolicyclass is an implementation of theHttpPipelinePolicyinterface.Information about the request that failed, used to determine whether a retry should be attempted.TheRetryOptionsclass provides configuration options for retry strategies.TheRetryPolicyclass is an implementation of theHttpPipelinePolicyinterface.The interface for determining the retry strategy used inRetryPolicy.Deprecated.TheUserAgentPolicyclass is an implementation of theHttpPipelinePolicyinterface.
HttpClientOptions.