Class AddHeadersPolicy
- java.lang.Object
-
- com.azure.android.core.http.policy.AddHeadersPolicy
-
- All Implemented Interfaces:
HttpPipelinePolicy
public class AddHeadersPolicy extends java.lang.Object implements HttpPipelinePolicy
The pipeline policy that adds a particular set of headers to HTTP requests.
-
-
Constructor Summary
Constructors Constructor Description AddHeadersPolicy(HttpHeaders headers)
Creates a AddHeadersPolicy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
process(HttpPipelinePolicyChain chain)
Applies the policy to aHttpRequest
and the correspondingHttpResponse
.
-
-
-
Constructor Detail
-
AddHeadersPolicy
public AddHeadersPolicy(HttpHeaders headers)
Creates a AddHeadersPolicy.- Parameters:
headers
- The headers to add to outgoing requests.
-
-
Method Detail
-
process
public void process(HttpPipelinePolicyChain chain)
Description copied from interface:HttpPipelinePolicy
Applies the policy to aHttpRequest
and the correspondingHttpResponse
.Policy implementations are expected to use
HttpPipelinePolicyChain.getRequest()
to access and intercept the request, then proceed to next policy by callingHttpPipelinePolicyChain.processNextPolicy(HttpRequest)
orHttpPipelinePolicyChain.processNextPolicy(HttpRequest, NextPolicyCallback)
. The policy can intercept the resulting response notified toNextPolicyCallback.onSuccess(HttpResponse, PolicyCompleter)
or error notified toNextPolicyCallback.onError(Throwable, PolicyCompleter)
and must signal the completion of the policy by callingPolicyCompleter.completed(HttpResponse)
orPolicyCompleter.completedError(Throwable)
.- Specified by:
process
in interfaceHttpPipelinePolicy
- Parameters:
chain
- The chain for the policy to access the request and response.
-
-