Package io.servicetalk.http.api
Interface RedirectConfig.RedirectPredicate
- Enclosing interface:
- RedirectConfig
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Predicate to make the final decision if redirect should be performed or not based on the given context.
Implementations should prefer running this predicate as the last check, after validation of the
HttpResponseStatus
, RedirectConfig.maxRedirects()
, RedirectConfig.allowedMethods()
,
presence of the Location
header, and
RedirectConfig.allowNonRelativeRedirects()
.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
test
(boolean relative, int redirectCount, HttpRequestMetaData previousRequest, HttpResponseMetaData redirectResponse) Decides if a redirect should be performed or not based on the given context.
-
Method Details
-
test
boolean test(boolean relative, int redirectCount, HttpRequestMetaData previousRequest, HttpResponseMetaData redirectResponse) Decides if a redirect should be performed or not based on the given context.- Parameters:
relative
- iftrue
, the redirect location was identified as relative to the previous requestredirectCount
- sequential counter of already processed redirects (starts from0
)previousRequest
- previous request that was redirectedredirectResponse
- response to redirect- Returns:
true
if the redirect should be processed based on the given context
-