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 anrequest
for the redirect attempt.int
Max number of redirect attempts to be made.boolean
shouldAttemptRedirect
(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
- theHttpRequest
containing the redirect url present in the response headerstryCount
- redirect attempts so farattemptedRedirectUrls
- attempted redirect locations used so far.- Returns:
true
if the request should be redirected,false
otherwise
-
createRedirectRequest
Creates anrequest
for the redirect attempt.- Parameters:
httpResponse
- theHttpResponse
containing the redirect url present in the response headers- Returns:
- the modified
HttpRequest
to redirect the incoming request.
-