Interface HttpTrait<T extends HttpTrait<T>>
-
- Type Parameters:
T- The concrete type that implements the trait. This is required so that fluent operations can continue to return the concrete type, rather than the trait type.
public interface HttpTrait<T extends HttpTrait<T>>AnAzure SDK for Java traitproviding a consistent interface for configuration of HTTP-specific settings. Refer to the Azure SDK for Java HTTP clients and pipelines documentation for more details on proper usage and configuration of the Azure SDK for Java HTTP clients.It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipelineis specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipelineis specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipelineis specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TaddPolicy(HttpPipelinePolicy pipelinePolicy)Adds apipeline policyto apply on each request sent.TclientOptions(ClientOptions clientOptions)Allows for setting common properties such as application ID, headers, proxy configuration, etc.ThttpClient(HttpClient httpClient)Sets theHttpClientto use for sending and receiving requests to and from the service.ThttpLogOptions(HttpLogOptions logOptions)Sets thelogging configurationto use when sending and receiving requests to and from the service.Tpipeline(HttpPipeline pipeline)Sets theHttpPipelineto use for the service client.TretryOptions(RetryOptions retryOptions)Sets theRetryOptionsfor all the requests made through the client.
-
-
-
Method Detail
-
httpClient
T httpClient(HttpClient httpClient)
Sets theHttpClientto use for sending and receiving requests to and from the service.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipelineis specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipelineis specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipelineis specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Parameters:
httpClient- TheHttpClientto use for requests.- Returns:
- Returns the same concrete type with the appropriate properties updated, to allow for fluent chaining of operations.
-
pipeline
T pipeline(HttpPipeline pipeline)
Sets theHttpPipelineto use for the service client.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipelineis specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipelineis specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipelineis specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Parameters:
pipeline-HttpPipelineto use for sending service requests and receiving responses.- Returns:
- Returns the same concrete type with the appropriate properties updated, to allow for fluent chaining of operations.
-
addPolicy
T addPolicy(HttpPipelinePolicy pipelinePolicy)
Adds apipeline policyto apply on each request sent.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipelineis specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipelineis specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipelineis specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Parameters:
pipelinePolicy- Apipeline policy.- Returns:
- Returns the same concrete type with the appropriate properties updated, to allow for fluent chaining of operations.
- Throws:
NullPointerException- IfpipelinePolicyisnull.
-
retryOptions
T retryOptions(RetryOptions retryOptions)
Sets theRetryOptionsfor all the requests made through the client.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipelineis specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipelineis specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipelineis specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Parameters:
retryOptions- TheRetryOptionsto use for all the requests made through the client.- Returns:
- Returns the same concrete type with the appropriate properties updated, to allow for fluent chaining of operations.
-
httpLogOptions
T httpLogOptions(HttpLogOptions logOptions)
Sets thelogging configurationto use when sending and receiving requests to and from the service. If alogLevelis not provided, default value ofHttpLogDetailLevel.NONEis set.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipelineis specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipelineis specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipelineis specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Parameters:
logOptions- Thelogging configurationto use when sending and receiving requests to and from the service.- Returns:
- Returns the same concrete type with the appropriate properties updated, to allow for fluent chaining of operations.
-
clientOptions
T clientOptions(ClientOptions clientOptions)
Allows for setting common properties such as application ID, headers, proxy configuration, etc. Note that it is recommended that this method be called with an instance of theHttpClientOptionsclass (a subclass of theClientOptionsbase class). The HttpClientOptions subclass provides more configuration options suitable for HTTP clients, which is applicable for any class that implements this HttpTrait interface.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipelineis specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipelineis specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipelineis specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Parameters:
clientOptions- A configured instance ofHttpClientOptions.- Returns:
- Returns the same concrete type with the appropriate properties updated, to allow for fluent chaining of operations.
- See Also:
HttpClientOptions
-
-