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

79 строки
9.4 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.core.http.policy.RedirectPolicy"
fullName: "com.azure.core.http.policy.RedirectPolicy"
name: "RedirectPolicy"
nameWithType: "RedirectPolicy"
summary: "The `RedirectPolicy` 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 final class **RedirectPolicy**</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.RedirectPolicy.RedirectPolicy()"
fullName: "com.azure.core.http.policy.RedirectPolicy.RedirectPolicy()"
name: "RedirectPolicy()"
nameWithType: "RedirectPolicy.RedirectPolicy()"
summary: "Creates <xref uid=\"com.azure.core.http.policy.RedirectPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RedirectPolicy\"></xref> with default <xref uid=\"com.azure.core.http.policy.DefaultRedirectStrategy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"DefaultRedirectStrategy\"></xref> as <xref uid=\"com.azure.core.http.policy.RedirectStrategy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RedirectStrategy\"></xref> and uses the redirect status response code (301, 302, 307, 308) to determine if this request should be redirected."
syntax: "public RedirectPolicy()"
desc: "Creates <xref uid=\"com.azure.core.http.policy.RedirectPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RedirectPolicy\"></xref> with default <xref uid=\"com.azure.core.http.policy.DefaultRedirectStrategy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"DefaultRedirectStrategy\"></xref> as <xref uid=\"com.azure.core.http.policy.RedirectStrategy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RedirectStrategy\"></xref> and uses the redirect status response code (301, 302, 307, 308) to determine if this request should be redirected."
- uid: "com.azure.core.http.policy.RedirectPolicy.RedirectPolicy(com.azure.core.http.policy.RedirectStrategy)"
fullName: "com.azure.core.http.policy.RedirectPolicy.RedirectPolicy(RedirectStrategy redirectStrategy)"
name: "RedirectPolicy(RedirectStrategy redirectStrategy)"
nameWithType: "RedirectPolicy.RedirectPolicy(RedirectStrategy redirectStrategy)"
summary: "Creates <xref uid=\"com.azure.core.http.policy.RedirectPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RedirectPolicy\"></xref> with the provided `redirectStrategy` as <xref uid=\"com.azure.core.http.policy.RedirectStrategy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RedirectStrategy\"></xref> to determine if this request should be redirected."
parameters:
- description: "The <xref uid=\"com.azure.core.http.policy.RedirectStrategy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RedirectStrategy\"></xref> used for redirection."
name: "redirectStrategy"
type: "<xref href=\"com.azure.core.http.policy.RedirectStrategy?alt=com.azure.core.http.policy.RedirectStrategy&text=RedirectStrategy\" data-throw-if-not-resolved=\"False\" />"
syntax: "public RedirectPolicy(RedirectStrategy redirectStrategy)"
desc: "Creates <xref uid=\"com.azure.core.http.policy.RedirectPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RedirectPolicy\"></xref> with the provided `redirectStrategy` as <xref uid=\"com.azure.core.http.policy.RedirectStrategy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RedirectStrategy\"></xref> to determine if this request should be redirected."
methods:
- uid: "com.azure.core.http.policy.RedirectPolicy.process(com.azure.core.http.HttpPipelineCallContext,com.azure.core.http.HttpPipelineNextPolicy)"
fullName: "com.azure.core.http.policy.RedirectPolicy.process(HttpPipelineCallContext context, HttpPipelineNextPolicy next)"
name: "process(HttpPipelineCallContext context, HttpPipelineNextPolicy next)"
nameWithType: "RedirectPolicy.process(HttpPipelineCallContext context, HttpPipelineNextPolicy next)"
summary: "Processes provided request context and invokes the next policy."
parameters:
- name: "context"
type: "<xref href=\"com.azure.core.http.HttpPipelineCallContext?alt=com.azure.core.http.HttpPipelineCallContext&text=HttpPipelineCallContext\" data-throw-if-not-resolved=\"False\" />"
- 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: "Processes provided request context and invokes the next policy."
returns:
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.RedirectPolicy.processSync(com.azure.core.http.HttpPipelineCallContext,com.azure.core.http.HttpPipelineNextSyncPolicy)"
fullName: "com.azure.core.http.policy.RedirectPolicy.processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next)"
name: "processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next)"
nameWithType: "RedirectPolicy.processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next)"
summary: "Processes provided request context and invokes the next policy synchronously."
parameters:
- name: "context"
type: "<xref href=\"com.azure.core.http.HttpPipelineCallContext?alt=com.azure.core.http.HttpPipelineCallContext&text=HttpPipelineCallContext\" data-throw-if-not-resolved=\"False\" />"
- 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: "Processes provided request context and invokes the next policy synchronously."
returns:
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 `RedirectPolicy` 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 handles HTTP redirects by determining if an HTTP request should be redirected based on the received <xref uid=\"com.azure.core.http.HttpResponse\" data-throw-if-not-resolved=\"false\" data-raw-source=\"HttpResponse\"></xref>.\n\nThis class is useful when you need to handle HTTP redirects in a pipeline. It uses a <xref uid=\"com.azure.core.http.policy.RedirectStrategy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RedirectStrategy\"></xref> to decide if a request should be redirected. By default, it uses the <xref uid=\"com.azure.core.http.policy.DefaultRedirectStrategy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"DefaultRedirectStrategy\"></xref>, which redirects the request based on the HTTP status code of the response.\n\n**Code sample:**\n\nIn this example, a `RedirectPolicy` is constructed and can be added to a pipeline. For a request sent by the pipeline, if the server responds with a redirect status code, the request will be redirected according to the <xref uid=\"com.azure.core.http.policy.RedirectStrategy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"RedirectStrategy\"></xref> used by the `RedirectPolicy`.\n\n```java\nRedirectPolicy redirectPolicy = new RedirectPolicy();\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