-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Redirect Policy to Azure core #23617
Conversation
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/MaxAttemptRedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/MaxAttemptRedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/MaxAttemptRedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/MaxAttemptRedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/MaxAttemptRedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/MaxAttemptRedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectStrategy.java
Outdated
Show resolved
Hide resolved
09cd8a9
to
fe73a20
Compare
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectStrategy.java
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/DefaultRedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/DefaultRedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/DefaultRedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/DefaultRedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/DefaultRedirectStrategy.java
Outdated
Show resolved
Hide resolved
This pull request is protected by Check Enforcer. What is Check Enforcer?Check Enforcer helps ensure all pull requests are covered by at least one check-run (typically an Azure Pipeline). When all check-runs associated with this pull request pass then Check Enforcer itself will pass. Why am I getting this message?You are getting this message because Check Enforcer did not detect any check-runs being associated with this pull request within five minutes. This may indicate that your pull request is not covered by any pipelines and so Check Enforcer is correctly blocking the pull request being merged. What should I do now?If the check-enforcer check-run is not passing and all other check-runs associated with this PR are passing (excluding license-cla) then you could try telling Check Enforcer to evaluate your pull request again. You can do this by adding a comment to this pull request as follows: What if I am onboarding a new service?Often, new services do not have validation pipelines associated with them, in order to bootstrap pipelines for a new service, you can issue the following command as a pull request comment: |
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/DefaultRedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/DefaultRedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectStrategy.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/DefaultRedirectStrategy.java
Outdated
Show resolved
Hide resolved
private static final String DEFAULT_REDIRECT_LOCATION_HEADER_NAME = "Location"; | ||
private static final int PERMANENT_REDIRECT_STATUS_CODE = 308; | ||
private static final int TEMPORARY_REDIRECT_STATUS_CODE = 307; | ||
private static final Set<HttpMethod> DEFAULT_REDIRECT_ALLOWED_METHODS = new HashSet<HttpMethod>() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private static final Set<HttpMethod> DEFAULT_REDIRECT_ALLOWED_METHODS = new HashSet<HttpMethod>() { | |
private static final Set<HttpMethod> DEFAULT_REDIRECT_ALLOWED_METHODS = new HashSet<>() { |
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/DefaultRedirectStrategy.java
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/DefaultRedirectStrategy.java
Outdated
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectStrategy.java
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/DefaultRedirectStrategy.java
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/RedirectPolicy.java
Show resolved
Hide resolved
sdk/core/azure-core/src/main/java/com/azure/core/http/policy/DefaultRedirectStrategy.java
Outdated
Show resolved
Hide resolved
Release app microsoft.app 2023 04 01 preview (Azure#24103) * Adds base for updating Microsoft.App from version preview/2022-11-01-preview to version 2023-04-01-preview * Updates readme * Updates API version in new specs and examples * support terminationGracePeriodSeconds (Azure#23476) * Support SubPath in volume mount and mount options for azure file volume (Azure#23496) * Support SubPath in volume mount and mount options for azure file volume * update description * Add replica/container running state (Azure#23617) * add replica/container running state * spell error fix * add event trigger for Container Jobs 2023-04-01-preview (Azure#23724) * add event trigger for Container Jobs 2023-04-01-preview * prettier and avocado fix --------- Co-authored-by: Taher Darolywala <[email protected]> * Resolve Comments for Event driven jobs (Azure#23729) * Resolve Comments for Event driven jobs * change scaling rule to azure-servicebus * update example --------- Co-authored-by: Taher Darolywala <[email protected]> * Swagger change for mtls and runningState (Azure#23767) * 1. Add mtls properties for managed ManagedEnvironment 2. Add running state for Revision * fix * Add ContainerApp Start/Stop for 2023-04-01-preview (Azure#23497) * Add ContainerApp Start/Stop for 2023-04-01-preview * Fix validation error * Fix validation error * Change example to add location in header * Fix lint error * Fix lint issue * Fix lint issue * Fix lint issue * Fix lint issue * Fix lint issue * Fix lint issue * Fix lint issue * Fix lint issue * Add new source controls properties (Azure#23891) * Add new source controls properties * Update examples * fix examples * Change event trigger replica properties to executions, add polling in… (Azure#23810) * Change event trigger replica properties to executions, add polling interval to event trigger, fix typos and descriptions to accommodate both apps and jobs * Fix validation errors * code review comments * Fix formatting errors * Code review comments * Add single execution history endpoint, refactor copy paste code for j… (Azure#23816) * Add single execution history endpoint, refactor copy paste code for jobName and jobExecutionName path parameters * Fix validation errors from ARM * Fix validation errors * Code review comments * Fix validation error * code review comments from Anand * Add springboard properties (Azure#23932) * Add springboard properties * CR comments * Update specification/app/resource-manager/Microsoft.App/preview/2023-04-01-preview/examples/ContainerApps_CreateOrUpdate.json Co-authored-by: Jitin John <[email protected]> * Update specification/app/resource-manager/Microsoft.App/preview/2023-04-01-preview/examples/ContainerApps_CreateOrUpdate.json Co-authored-by: Jitin John <[email protected]> --------- Co-authored-by: Jitin John <[email protected]> * Fix Lint issues in ContainerApps.json (Azure#24107) * Fix lint issue * Fix format issue * Fix json format issue * Fix model validation * Fix lint error * fix param (Azure#24166) Co-authored-by: Chenghui Yu <[email protected]> --------- Co-authored-by: Zunli Hu <[email protected]> Co-authored-by: njucz <[email protected]> Co-authored-by: LaylaLiu-gmail <[email protected]> Co-authored-by: Xingjian Wang <[email protected]> Co-authored-by: Taher Daroly <[email protected]> Co-authored-by: Taher Darolywala <[email protected]> Co-authored-by: zhenqxuMSFT <[email protected]> Co-authored-by: Zijian-Ju <[email protected]> Co-authored-by: Sanchit Mehta <[email protected]> Co-authored-by: trajkobal <[email protected]> Co-authored-by: Ahmed ElSayed <[email protected]> Co-authored-by: Jitin John <[email protected]> Co-authored-by: Seris370 <[email protected]> Co-authored-by: Chenghui Yu <[email protected]>
This PR creates a new HttpPipelinePolicy in azure-core which is capable of handling redirect responses and forwarding the request to the new location.
The Default implementation of the
new RedirectPolicy()
uses theMAX_REDIRECT_ATTEMPTS = 3;
,LOCATION_HEADER_NAME = "Location";
and redirect HttpMethodsGET and HEAD
to determine if the request should be redirected or not.Allows the user to provide customized values for the number of redirect attempts, header look-up name and, set of allowed methods.
TODO:
Closes #23095