HttpPipelineCallContext Class
- java.
lang. Object - com.
azure. core. http. HttpPipelineCallContext
- com.
public final class HttpPipelineCallContext
Represents the context for a single HTTP request in the HTTP pipeline.
This class encapsulates the HTTP request and the associated context data. The context data is a key-value store that can be used to pass additional information along with the HTTP request.
It provides methods to get and set the HTTP request, get the context data, and get and set data in the context using a key.
This class is useful when you want to send an HTTP request through the HTTP pipeline and need to associate additional data with the request.
Method Summary
Modifier and Type | Method and Description |
---|---|
Context |
getContext()
Gets the context associated to the HTTP call. |
Optional<Object> |
getData(String key)
Gets a value with the given key stored in the context. |
Http |
getHttpRequest()
Gets the HTTP request. |
void |
setData(String key, Object value)
Stores a key-value data in the context. |
Http |
setHttpRequest(HttpRequest request)
Sets the HTTP request object in the context. |
Methods inherited from java.lang.Object
Method Details
getContext
public Context getContext()
Gets the context associated to the HTTP call.
The returned context is a snapshot of the data stored in this http pipeline call context.
Returns:
getData
public Optional
Gets a value with the given key stored in the context.
Parameters:
Returns:
getHttpRequest
public HttpRequest getHttpRequest()
Gets the HTTP request.
Returns:
setData
public void setData(String key, Object value)
Stores a key-value data in the context.
Parameters:
setHttpRequest
public HttpPipelineCallContext setHttpRequest(HttpRequest request)
Sets the HTTP request object in the context.
Parameters:
Returns:
Applies to
Azure SDK for Java
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for