Package io.servicetalk.http.api
Interface RedirectConfig
public interface RedirectConfig
Configuration options for redirection.
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Predicate to make the final decision if redirect should be performed or not based on the given context.static interface
Provides access to the full context of the redirect to apply transformations for the pre-initialized redirect request. -
Method Summary
Modifier and TypeMethodDescriptionHttpRequestMethod
s that are allowed to follow redirects.HttpResponseStatus
es that are allowed to follow redirects.boolean
Tells if redirection should follow non-relative redirects (if supported by the underlying client implementation).int
Maximum number of redirects to follow.RedirectConfig.RedirectPredicate
to make the final decision if redirect should be performed or not based on the given context.RedirectConfig.RedirectRequestTransformer
to 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()HttpResponseStatus
es that are allowed to follow redirects.All statuses in this set must belong to
REDIRECTION_3XX
status class.- Returns:
HttpResponseStatus
es that are allowed to follow redirects.
-
allowedMethods
Set<HttpRequestMethod> allowedMethods()HttpRequestMethod
s that are allowed to follow redirects.- Returns:
HttpRequestMethod
s 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.RedirectRequestTransformer
to preserve headers or message body.
- Returns:
true
if 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 previousrequest
as 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.RedirectPredicate
to make the final decision if redirect should be performed or not based on the given context.- Returns:
RedirectConfig.RedirectPredicate
to make the final decision if redirect should be performed or not based on the given context.
-
redirectRequestTransformer
RedirectConfig.RedirectRequestTransformer redirectRequestTransformer()RedirectConfig.RedirectRequestTransformer
to apply further modifications for the redirect request after it was initialized.- Returns:
RedirectConfig.RedirectRequestTransformer
to apply further modifications for the redirect request after it was initialized.
-