azure-docs-sdk-java/docs-ref-autogen/com.azure.core.http.policy....

154 строки
15 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.core.http.policy.UserAgentPolicy"
fullName: "com.azure.core.http.policy.UserAgentPolicy"
name: "UserAgentPolicy"
nameWithType: "UserAgentPolicy"
summary: "The `UserAgentPolicy` class is an implementation of the <xref uid=\"com.azure.core.http.policy.HttpPipelinePolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipelinePolicy\"></xref> interface."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
syntax: "public class **UserAgentPolicy**</br> implements <xref href=\"com.azure.core.http.policy.HttpPipelinePolicy?alt=com.azure.core.http.policy.HttpPipelinePolicy&text=HttpPipelinePolicy\" data-throw-if-not-resolved=\"False\" />"
constructors:
- uid: "com.azure.core.http.policy.UserAgentPolicy.UserAgentPolicy()"
fullName: "com.azure.core.http.policy.UserAgentPolicy.UserAgentPolicy()"
name: "UserAgentPolicy()"
nameWithType: "UserAgentPolicy.UserAgentPolicy()"
summary: "Creates a <xref uid=\"com.azure.core.http.policy.UserAgentPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"UserAgentPolicy\"></xref> with a default user agent string."
syntax: "public UserAgentPolicy()"
desc: "Creates a <xref uid=\"com.azure.core.http.policy.UserAgentPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"UserAgentPolicy\"></xref> with a default user agent string."
- uid: "com.azure.core.http.policy.UserAgentPolicy.UserAgentPolicy(java.lang.String)"
fullName: "com.azure.core.http.policy.UserAgentPolicy.UserAgentPolicy(String userAgent)"
name: "UserAgentPolicy(String userAgent)"
nameWithType: "UserAgentPolicy.UserAgentPolicy(String userAgent)"
summary: "Creates a User<wbr>Agent<wbr>Policy with `userAgent` as the header value."
parameters:
- description: "The user agent string to add to request headers."
name: "userAgent"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public UserAgentPolicy(String userAgent)"
desc: "Creates a UserAgentPolicy with `userAgent` as the header value. If `userAgent` is `null`, then the default user agent value is used."
- uid: "com.azure.core.http.policy.UserAgentPolicy.UserAgentPolicy(java.lang.String,java.lang.String,com.azure.core.util.Configuration,com.azure.core.util.ServiceVersion)"
fullName: "com.azure.core.http.policy.UserAgentPolicy.UserAgentPolicy(String sdkName, String sdkVersion, Configuration configuration, ServiceVersion version)"
name: "UserAgentPolicy(String sdkName, String sdkVersion, Configuration configuration, ServiceVersion version)"
nameWithType: "UserAgentPolicy.UserAgentPolicy(String sdkName, String sdkVersion, Configuration configuration, ServiceVersion version)"
summary: "Creates a User<wbr>Agent<wbr>Policy with the `sdkName` and `sdkVersion` in the User-Agent header value."
deprecatedTag: "Use <xref uid=\"com.azure.core.http.policy.UserAgentPolicy.UserAgentPolicy(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Configuration)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"UserAgentPolicy#UserAgentPolicy(String, String, String, Configuration)\"></xref> instead."
parameters:
- description: "Name of the client library."
name: "sdkName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Version of the client library."
name: "sdkVersion"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Configuration store that will be checked for <xref uid=\"com.azure.core.util.Configuration.PROPERTY_AZURE_TELEMETRY_DISABLED\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Configuration#PROPERTY_AZURE_TELEMETRY_DISABLED\"></xref>. If <code>null</code> is passed the <xref uid=\"com.azure.core.util.Configuration.getGlobalConfiguration()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"global configuration\"></xref> will be checked."
name: "configuration"
type: "<xref href=\"com.azure.core.util.Configuration?alt=com.azure.core.util.Configuration&text=Configuration\" data-throw-if-not-resolved=\"False\" />"
- description: "<xref uid=\"com.azure.core.util.ServiceVersion\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ServiceVersion\"></xref> of the service to be used when making requests."
name: "version"
type: "<xref href=\"com.azure.core.util.ServiceVersion?alt=com.azure.core.util.ServiceVersion&text=ServiceVersion\" data-throw-if-not-resolved=\"False\" />"
syntax: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html\">@Deprecated</a></br>public UserAgentPolicy(String sdkName, String sdkVersion, Configuration configuration, ServiceVersion version)"
desc: "Creates a UserAgentPolicy with the `sdkName` and `sdkVersion` in the User-Agent header value.\n\nIf the passed configuration contains true for AZURE\\_TELEMETRY\\_DISABLED the platform information won't be included in the user agent."
hasDeprecatedTag: true
- uid: "com.azure.core.http.policy.UserAgentPolicy.UserAgentPolicy(java.lang.String,java.lang.String,java.lang.String,com.azure.core.util.Configuration)"
fullName: "com.azure.core.http.policy.UserAgentPolicy.UserAgentPolicy(String applicationId, String sdkName, String sdkVersion, Configuration configuration)"
name: "UserAgentPolicy(String applicationId, String sdkName, String sdkVersion, Configuration configuration)"
nameWithType: "UserAgentPolicy.UserAgentPolicy(String applicationId, String sdkName, String sdkVersion, Configuration configuration)"
summary: "Creates a User<wbr>Agent<wbr>Policy with the `sdkName` and `sdkVersion` in the User-Agent header value."
parameters:
- description: "User specified application Id."
name: "applicationId"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Name of the client library."
name: "sdkName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Version of the client library."
name: "sdkVersion"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "Configuration store that will be checked for <xref uid=\"com.azure.core.util.Configuration.PROPERTY_AZURE_TELEMETRY_DISABLED\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Configuration#PROPERTY_AZURE_TELEMETRY_DISABLED\"></xref>. If <code>null</code> is passed the <xref uid=\"com.azure.core.util.Configuration.getGlobalConfiguration()\" data-throw-if-not-resolved=\"false\" data-raw-source=\"global configuration\"></xref> will be checked."
name: "configuration"
type: "<xref href=\"com.azure.core.util.Configuration?alt=com.azure.core.util.Configuration&text=Configuration\" data-throw-if-not-resolved=\"False\" />"
syntax: "public UserAgentPolicy(String applicationId, String sdkName, String sdkVersion, Configuration configuration)"
desc: "Creates a UserAgentPolicy with the `sdkName` and `sdkVersion` in the User-Agent header value.\n\nIf the passed configuration contains true for AZURE\\_TELEMETRY\\_DISABLED the platform information won't be included in the user agent."
fields:
- uid: "com.azure.core.http.policy.UserAgentPolicy.APPEND_USER_AGENT_CONTEXT_KEY"
fullName: "com.azure.core.http.policy.UserAgentPolicy.APPEND_USER_AGENT_CONTEXT_KEY"
name: "APPEND_USER_AGENT_CONTEXT_KEY"
nameWithType: "UserAgentPolicy.APPEND_USER_AGENT_CONTEXT_KEY"
summary: "Key for <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> to add a value which will be appended to the User-Agent supplied in this policy in an ad-hoc manner."
modifiers:
- "static"
- "final"
field:
value: "Append-User-Agent"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public static final String APPEND_USER_AGENT_CONTEXT_KEY"
desc: "Key for <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> to add a value which will be appended to the User-Agent supplied in this policy in an ad-hoc manner."
- uid: "com.azure.core.http.policy.UserAgentPolicy.OVERRIDE_USER_AGENT_CONTEXT_KEY"
fullName: "com.azure.core.http.policy.UserAgentPolicy.OVERRIDE_USER_AGENT_CONTEXT_KEY"
name: "OVERRIDE_USER_AGENT_CONTEXT_KEY"
nameWithType: "UserAgentPolicy.OVERRIDE_USER_AGENT_CONTEXT_KEY"
summary: "Key for <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> to add a value which will override the User-Agent supplied in this policy in an ad-hoc manner."
modifiers:
- "static"
- "final"
field:
value: "Override-User-Agent"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public static final String OVERRIDE_USER_AGENT_CONTEXT_KEY"
desc: "Key for <xref uid=\"com.azure.core.util.Context\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Context\"></xref> to add a value which will override the User-Agent supplied in this policy in an ad-hoc manner."
methods:
- uid: "com.azure.core.http.policy.UserAgentPolicy.process(com.azure.core.http.HttpPipelineCallContext,com.azure.core.http.HttpPipelineNextPolicy)"
fullName: "com.azure.core.http.policy.UserAgentPolicy.process(HttpPipelineCallContext context, HttpPipelineNextPolicy next)"
name: "process(HttpPipelineCallContext context, HttpPipelineNextPolicy next)"
nameWithType: "UserAgentPolicy.process(HttpPipelineCallContext context, HttpPipelineNextPolicy next)"
summary: "Updates the \"User-Agent\" header with the value supplied in the policy."
parameters:
- description: "request context"
name: "context"
type: "<xref href=\"com.azure.core.http.HttpPipelineCallContext?alt=com.azure.core.http.HttpPipelineCallContext&text=HttpPipelineCallContext\" data-throw-if-not-resolved=\"False\" />"
- description: "The next policy to invoke."
name: "next"
type: "<xref href=\"com.azure.core.http.HttpPipelineNextPolicy?alt=com.azure.core.http.HttpPipelineNextPolicy&text=HttpPipelineNextPolicy\" data-throw-if-not-resolved=\"False\" />"
syntax: "public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next)"
desc: "Updates the \"User-Agent\" header with the value supplied in the policy.\n\nThe `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."
returns:
description: "A publisher that initiates the request upon subscription and emits a response on completion."
type: "<a href=\"https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html\">Mono</a>&lt;<xref href=\"com.azure.core.http.HttpResponse?alt=com.azure.core.http.HttpResponse&text=HttpResponse\" data-throw-if-not-resolved=\"False\" />&gt;"
- uid: "com.azure.core.http.policy.UserAgentPolicy.processSync(com.azure.core.http.HttpPipelineCallContext,com.azure.core.http.HttpPipelineNextSyncPolicy)"
fullName: "com.azure.core.http.policy.UserAgentPolicy.processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next)"
name: "processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next)"
nameWithType: "UserAgentPolicy.processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next)"
summary: "Updates the \"User-Agent\" header with the value supplied in the policy synchronously."
parameters:
- description: "request context"
name: "context"
type: "<xref href=\"com.azure.core.http.HttpPipelineCallContext?alt=com.azure.core.http.HttpPipelineCallContext&text=HttpPipelineCallContext\" data-throw-if-not-resolved=\"False\" />"
- description: "The next policy to invoke."
name: "next"
type: "<xref href=\"com.azure.core.http.HttpPipelineNextSyncPolicy?alt=com.azure.core.http.HttpPipelineNextSyncPolicy&text=HttpPipelineNextSyncPolicy\" data-throw-if-not-resolved=\"False\" />"
syntax: "public HttpResponse processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next)"
desc: "Updates the \"User-Agent\" header with the value supplied in the policy synchronously.\n\nThe `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."
returns:
description: "A response."
type: "<xref href=\"com.azure.core.http.HttpResponse?alt=com.azure.core.http.HttpResponse&text=HttpResponse\" data-throw-if-not-resolved=\"False\" />"
type: "class"
desc: "The `UserAgentPolicy` class is an implementation of the <xref uid=\"com.azure.core.http.policy.HttpPipelinePolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpPipelinePolicy\"></xref> interface. This policy is used to add a \"User-Agent\" header to each `HttpRequest`.\n\nThis class is useful when you need to add a specific \"User-Agent\" header for all requests in a pipeline. It ensures that the \"User-Agent\" header is set correctly for each request. The \"User-Agent\" header is used to provide the server with information about the software used by the client.\n\n**Code sample:**\n\nIn this example, a `UserAgentPolicy` is created with a \"User-Agent\" header value of \"MyApp/1.0\". Once added to the pipeline, requests will have their \"User-Agent\" header set to \"MyApp/1.0\" by the `UserAgentPolicy`.\n\n```java\nUserAgentPolicy userAgentPolicy = new UserAgentPolicy(\"MyApp/1.0\");\n```"
implements:
- "<xref href=\"com.azure.core.http.policy.HttpPipelinePolicy?alt=com.azure.core.http.policy.HttpPipelinePolicy&text=HttpPipelinePolicy\" data-throw-if-not-resolved=\"False\" />"
metadata: {}
package: "com.azure.core.http.policy"
artifact: com.azure:azure-core:1.52.0