Package com.azure.core.http.policy
Class CookiePolicy
java.lang.Object
com.azure.core.http.policy.CookiePolicy
- All Implemented Interfaces:
HttpPipelinePolicy
The CookiePolicy class is an implementation of the HttpPipelinePolicy interface. This policy is
used to handle cookies in HTTP requests and responses.
This class stores cookies from the "Set-Cookie" header of the HTTP response and adds them to subsequent HTTP requests. This is useful for maintaining session information or other stateful information across multiple requests to the same server.
Code sample:
In this example, a CookiePolicy is constructed. The policy can then be added to a pipeline.
Any cookies set by the server in the response to a request by the pipeline will be stored by the CookiePolicy
and added to subsequent requests to the same server.
CookiePolicy cookiePolicy = new CookiePolicy();
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprocess(HttpPipelineCallContext context, HttpPipelineNextPolicy next) Processes provided request context and invokes the next policy.processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next) Processes provided request context and invokes the next policy synchronously.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.azure.core.http.policy.HttpPipelinePolicy
getPipelinePosition
-
Constructor Details
-
CookiePolicy
public CookiePolicy()Creates a new instance ofCookiePolicy.
-
-
Method Details
-
process
Description copied from interface:HttpPipelinePolicyProcesses provided request context and invokes the next policy.- Specified by:
processin interfaceHttpPipelinePolicy- Parameters:
context- The request context.next- The next policy to invoke.- Returns:
- A publisher that initiates the request upon subscription and emits a response on completion.
-
processSync
Description copied from interface:HttpPipelinePolicyProcesses provided request context and invokes the next policy synchronously.- Specified by:
processSyncin interfaceHttpPipelinePolicy- Parameters:
context- The request context.next- The next policy to invoke.- Returns:
- A publisher that initiates the request upon subscription and emits a response on completion.
-