Package com.azure.core.http.policy
Interface RedirectStrategy
-
- All Known Implementing Classes:
DefaultRedirectStrategy
public interface RedirectStrategyThe interface for determining theredirect strategyused inRedirectPolicy.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description HttpRequestcreateRedirectRequest(HttpResponse httpResponse)Creates anrequestfor the redirect attempt.intgetMaxAttempts()Max 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 Detail
-
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
HttpRequest createRedirectRequest(HttpResponse httpResponse)
Creates anrequestfor the redirect attempt.- Parameters:
httpResponse- theHttpResponsecontaining the redirect url present in the response headers- Returns:
- the modified
HttpRequestto redirect the incoming request.
-
-