Package io.servicetalk.http.utils
Class RedirectingHttpRequesterFilter
java.lang.Object
io.servicetalk.http.utils.RedirectingHttpRequesterFilter
- All Implemented Interfaces:
HttpExecutionStrategyInfluencer,StreamingHttpClientFilterFactory,StreamingHttpConnectionFilterFactory,ExecutionStrategyInfluencer<HttpExecutionStrategy>
public final class RedirectingHttpRequesterFilter
extends Object
implements StreamingHttpClientFilterFactory, StreamingHttpConnectionFilterFactory
An HTTP request filter that performs automatic
redirection if a client receives
3XX status code in the response.
Notes:
- This implementation will not parse a payload for
300 (Multiple Choices)response code, if a preferred choice's URI reference is not returned in theLocationheader. - Depending on its parameters and context:
HttpClientorHttpConnection, this filter may be limited to automatically following relative redirects only. - This implementation will automatically redirect headers and message body for relative locations.
- For security reasons, this implementation will NOT automatically redirect headers and message body for
non-relative locations. Use
RedirectConfigto opt-in for redirect of requires request components.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance, only performing relative redirects.Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptioncreate(FilterableStreamingHttpClient client) Creates aStreamingHttpClientFilterusing the providedStreamingHttpClientFilter.create(FilterableStreamingHttpConnection connection) Create aStreamingHttpConnectionFilterusing the providedFilterableStreamingHttpConnection.Return anExecutionStrategythat describes the offloads required by the influencer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.servicetalk.http.api.HttpExecutionStrategyInfluencer
influenceStrategy
-
Constructor Details
-
RedirectingHttpRequesterFilter
public RedirectingHttpRequesterFilter()Create a new instance, only performing relative redirects. -
RedirectingHttpRequesterFilter
Create a new instance.- Parameters:
config-RedirectConfigto customize the behavior.
-
-
Method Details
-
create
Description copied from interface:StreamingHttpClientFilterFactoryCreates aStreamingHttpClientFilterusing the providedStreamingHttpClientFilter.- Specified by:
createin interfaceStreamingHttpClientFilterFactory- Parameters:
client-FilterableStreamingHttpClientto filter- Returns:
StreamingHttpClientFilterusing the providedStreamingHttpClientFilter.
-
create
Description copied from interface:StreamingHttpConnectionFilterFactoryCreate aStreamingHttpConnectionFilterusing the providedFilterableStreamingHttpConnection.- Specified by:
createin interfaceStreamingHttpConnectionFilterFactory- Parameters:
connection-FilterableStreamingHttpConnectionto filter- Returns:
StreamingHttpConnectionFilterusing the providedFilterableStreamingHttpConnection.
-
requiredOffloads
Description copied from interface:HttpExecutionStrategyInfluencerReturn anExecutionStrategythat describes the offloads required by the influencer.The provided default implementation requests offloading of all operations. Implementations that require no offloading should be careful to return
HttpExecutionStrategies.offloadNone()rather thanHttpExecutionStrategies.offloadNever(). Implementations should avoid returningHttpExecutionStrategies.defaultStrategy(), instead returning the strategy they require orHttpExecutionStrategies.offloadAll()if offloading for all paths is required (safe default).- Specified by:
requiredOffloadsin interfaceExecutionStrategyInfluencer<HttpExecutionStrategy>- Specified by:
requiredOffloadsin interfaceHttpExecutionStrategyInfluencer- Returns:
- the
ExecutionStrategyrequired by the influencer.
-