Package io.servicetalk.http.api
Interface RedirectConfig
public interface RedirectConfig
Configuration options for redirection.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacePredicate to make the final decision if redirect should be performed or not based on the given context.static interfaceProvides access to the full context of the redirect to apply transformations for the pre-initialized redirect request. -
Method Summary
Modifier and TypeMethodDescriptionHttpRequestMethods that are allowed to follow redirects.HttpResponseStatuses that are allowed to follow redirects.booleanTells if redirection should follow non-relative redirects (if supported by the underlying client implementation).intMaximum number of redirects to follow.RedirectConfig.RedirectPredicateto make the final decision if redirect should be performed or not based on the given context.RedirectConfig.RedirectRequestTransformerto apply further modifications for the redirect request after it was initialized.
-
Method Details
-
maxRedirects
int maxRedirects()Maximum number of redirects to follow.- Returns:
- maximum number of redirects to follow.
-
allowedStatuses
Set<HttpResponseStatus> allowedStatuses()HttpResponseStatuses that are allowed to follow redirects.All statuses in this set must belong to
REDIRECTION_3XXstatus class.- Returns:
HttpResponseStatuses that are allowed to follow redirects.
-
allowedMethods
Set<HttpRequestMethod> allowedMethods()HttpRequestMethods that are allowed to follow redirects.- Returns:
HttpRequestMethods that are allowed to follow redirects.
-
allowNonRelativeRedirects
boolean allowNonRelativeRedirects()Tells if redirection should follow non-relative redirects (if supported by the underlying client implementation). Non-relative redirects are redirects to either a different target host/port or a different scheme.Notes:
- This option has effect only when redirections is performed by a client that is capable to communicate
with multiple target hosts or schemes, like the one which is produced by
MultiAddressHttpClientBuilder. If a client is limited to only one target host/port/scheme, it will follow only relative redirects. - For security reasons, redirection should not automatically copy headers nor message body of the original
request for non-relative locations. Use
RedirectConfig.RedirectRequestTransformerto preserve headers or message body.
- Returns:
trueif redirection should follow non-relative redirects (if supported by the underlying client implementation).- See Also:
- This option has effect only when redirections is performed by a client that is capable to communicate
with multiple target hosts or schemes, like the one which is produced by
-
locationMapper
BiFunction<HttpRequestMetaData,HttpResponseMetaData, locationMapper()String> A function to extract redirect location information from the redirectresponse, optionally considering the previousrequestas well.- Returns:
- A function to extract redirect location information. If the function returns
null, redirection response won't be followed.
-
redirectPredicate
RedirectConfig.RedirectPredicate redirectPredicate()RedirectConfig.RedirectPredicateto make the final decision if redirect should be performed or not based on the given context.- Returns:
RedirectConfig.RedirectPredicateto make the final decision if redirect should be performed or not based on the given context.
-
redirectRequestTransformer
RedirectConfig.RedirectRequestTransformer redirectRequestTransformer()RedirectConfig.RedirectRequestTransformerto apply further modifications for the redirect request after it was initialized.- Returns:
RedirectConfig.RedirectRequestTransformerto apply further modifications for the redirect request after it was initialized.
-