Class IgnitionRedirectStrategy
- All Implemented Interfaces:
org.apache.hc.client5.http.protocol.RedirectStrategy
This decides only whether a redirect is followed, and to what URI. Building the follow-up request, including any change of method, is the client's redirect interceptor's job.
GET and HEAD follow redirects normally, as does any method on a 303 See
Other. Every other combination is refused: a 301, 302, 307 or
308 answering a POST, PUT or DELETE is returned to the caller rather
than resent, because replaying a request that changes server state is the caller's decision to
make.
Redirects that cross an origin are refused when the request carries an Authorization
or Cookie header, so credentials are never forwarded to a host the caller did not
address. The 3xx response is returned instead.
Install on a client with HttpClientBuilder#setRedirectStrategy(INSTANCE).
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanisRedirected(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context) Returns whether the response should be followed to itsLocation.Methods inherited from class org.apache.hc.client5.http.impl.DefaultRedirectStrategy
createLocationURI, getLocationURI, isRedirectAllowed
-
Field Details
-
INSTANCE
-
-
Method Details
-
isRedirected
public boolean isRedirected(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context) throws org.apache.hc.core5.http.ProtocolException Returns whether the response should be followed to itsLocation.- Specified by:
isRedirectedin interfaceorg.apache.hc.client5.http.protocol.RedirectStrategy- Overrides:
isRedirectedin classorg.apache.hc.client5.http.impl.DefaultRedirectStrategy- Parameters:
request- the request that produced the responseresponse- the response to evaluatecontext- the active context- Returns:
- whether the response should be followed to its
Location - Throws:
org.apache.hc.core5.http.ProtocolException- if the response cannot be interpreted
-