public class UserAgentPolicy extends Object implements HttpPipelinePolicy
Modifier and Type | Field and Description |
---|---|
static String |
APPEND_USER_AGENT_CONTEXT_KEY
Key for
Context to add a value which will be appended to the User-Agent supplied in this policy in an
ad-hoc manner. |
static String |
OVERRIDE_USER_AGENT_CONTEXT_KEY
Key for
Context to add a value which will override the User-Agent supplied in this policy in an ad-hoc
manner. |
Constructor and Description |
---|
UserAgentPolicy()
Creates a
UserAgentPolicy with a default user agent string. |
UserAgentPolicy(String userAgent)
Creates a UserAgentPolicy with
userAgent as the header value. |
UserAgentPolicy(String sdkName,
String sdkVersion,
Configuration configuration,
ServiceVersion version)
Deprecated.
|
UserAgentPolicy(String applicationId,
String sdkName,
String sdkVersion,
Configuration configuration)
Creates a UserAgentPolicy with the
sdkName and sdkVersion in the User-Agent header value. |
Modifier and Type | Method and Description |
---|---|
Mono<HttpResponse> |
process(HttpPipelineCallContext context,
HttpPipelineNextPolicy next)
Updates the "User-Agent" header with the value supplied in the policy.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPipelinePosition
public static final String OVERRIDE_USER_AGENT_CONTEXT_KEY
Context
to add a value which will override the User-Agent supplied in this policy in an ad-hoc
manner.public static final String APPEND_USER_AGENT_CONTEXT_KEY
Context
to add a value which will be appended to the User-Agent supplied in this policy in an
ad-hoc manner.public UserAgentPolicy()
UserAgentPolicy
with a default user agent string.public UserAgentPolicy(String userAgent)
userAgent
as the header value. If userAgent
is null
, then
the default user agent value is used.userAgent
- The user agent string to add to request headers.public UserAgentPolicy(String applicationId, String sdkName, String sdkVersion, Configuration configuration)
sdkName
and sdkVersion
in the User-Agent header value.
If the passed configuration contains true for AZURE_TELEMETRY_DISABLED the platform information won't be included in the user agent.
applicationId
- User specified application Id.sdkName
- Name of the client library.sdkVersion
- Version of the client library.configuration
- Configuration store that will be checked for Configuration.PROPERTY_AZURE_TELEMETRY_DISABLED
. If null
is passed the global configuration
will be checked.@Deprecated public UserAgentPolicy(String sdkName, String sdkVersion, Configuration configuration, ServiceVersion version)
UserAgentPolicy.UserAgentPolicy(String, String, String, Configuration)
instead.sdkName
and sdkVersion
in the User-Agent header value.
If the passed configuration contains true for AZURE_TELEMETRY_DISABLED the platform information won't be included in the user agent.
sdkName
- Name of the client library.sdkVersion
- Version of the client library.version
- ServiceVersion
of the service to be used when making requests.configuration
- Configuration store that will be checked for Configuration.PROPERTY_AZURE_TELEMETRY_DISABLED
. If null
is passed the global configuration
will be checked.public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next)
The context
will be checked for Override-User-Agent
and Append-User-Agent
.
Override-User-Agent
will take precedence over the value supplied in the policy,
Append-User-Agent
will be appended to the value supplied in the policy.
process
in interface HttpPipelinePolicy
context
- request contextnext
- The next policy to invoke.Copyright © 2021 Microsoft Corporation. All rights reserved.