Module methanol

Class RedirectingInterceptor

java.lang.Object
com.github.mizosoft.methanol.internal.cache.RedirectingInterceptor
All Implemented Interfaces:
Methanol.Interceptor

public final class RedirectingInterceptor extends Object implements Methanol.Interceptor
An Methanol.Interceptor that follows redirects. The interceptor is applied prior to the cache interceptor only if one is installed. Allowing the cache to intercept redirects increases its efficiency as network access can be avoided in case a redirected URI is accessed repeatedly (provided the redirecting response is cacheable). Additionally, this ensures correctness in case a cacheable response is received for a redirected request. In such case, the response should be cached for the URI the request was redirected to, not the initiating URI.

For best compatibility, the interceptor follows HttpClient's redirecting behaviour.