Package com.azure.core.http.policy
Interface RedirectStrategy
- All Known Implementing Classes:
DefaultRedirectStrategy
public interface RedirectStrategy
The interface for determining the
redirect strategy used in RedirectPolicy.-
Method Summary
Modifier and TypeMethodDescriptioncreateRedirectRequest(HttpResponse httpResponse) Creates anrequestfor the redirect attempt.intMax number of redirect attempts to be made.booleanshouldAttemptRedirect(HttpPipelineCallContext context, HttpResponse httpResponse, int tryCount, Set<String> attemptedRedirectUrls) Determines if the url should be redirected between each try.
-
Method Details
-
getMaxAttempts
int getMaxAttempts()Max number of redirect attempts to be made.- Returns:
- The max number of redirect attempts.
-
shouldAttemptRedirect
boolean shouldAttemptRedirect(HttpPipelineCallContext context, HttpResponse httpResponse, int tryCount, Set<String> attemptedRedirectUrls) Determines if the url should be redirected between each try.- Parameters:
context- theHTTP pipeline context.httpResponse- theHttpRequestcontaining the redirect url present in the response headerstryCount- redirect attempts so farattemptedRedirectUrls- attempted redirect locations used so far.- Returns:
trueif the request should be redirected,falseotherwise
-
createRedirectRequest
Creates anrequestfor the redirect attempt.- Parameters:
httpResponse- theHttpResponsecontaining the redirect url present in the response headers- Returns:
- the modified
HttpRequestto redirect the incoming request.
-