Class HttpLoggingPolicy
- java.lang.Object
-
- com.azure.android.core.http.policy.HttpLoggingPolicy
-
- All Implemented Interfaces:
HttpPipelinePolicy
public class HttpLoggingPolicy extends java.lang.Object implements HttpPipelinePolicy
The pipeline policy that handles logging of HTTP requests and responses.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
RETRY_COUNT_CONTEXT
Key forRequestContext
to pass request retry count metadata for logging.
-
Constructor Summary
Constructors Constructor Description HttpLoggingPolicy(HttpLogOptions httpLogOptions)
Creates an HttpLoggingPolicy with the given log configurations.
-
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
.
-
-
-
Field Detail
-
RETRY_COUNT_CONTEXT
public static final java.lang.String RETRY_COUNT_CONTEXT
Key forRequestContext
to pass request retry count metadata for logging.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HttpLoggingPolicy
public HttpLoggingPolicy(HttpLogOptions httpLogOptions)
Creates an HttpLoggingPolicy with the given log configurations.- Parameters:
httpLogOptions
- The HTTP logging configuration options.
-
-
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.
-
-