Package org.apache.hc.client5.http.impl
Class DefaultRedirectStrategy
java.lang.Object
org.apache.hc.client5.http.impl.DefaultRedirectStrategy
- All Implemented Interfaces:
RedirectStrategy
@Contract(threading=STATELESS)
public class DefaultRedirectStrategy
extends Object
implements RedirectStrategy
Default implementation of
RedirectStrategy
.- Since:
- 4.1
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected URI
createLocationURI
(String location) getLocationURI
(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context) boolean
isRedirected
(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context) Determines if a request should be redirected to a new location given the response from the target server.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
DefaultRedirectStrategy
public DefaultRedirectStrategy()
-
-
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 Description copied from interface:RedirectStrategy
Determines if a request should be redirected to a new location given the response from the target server.- Specified by:
isRedirected
in interfaceRedirectStrategy
- Parameters:
request
- the executed requestresponse
- the response received from the target servercontext
- the context for the request execution- Returns:
true
if the request should be redirected,false
otherwise- Throws:
org.apache.hc.core5.http.ProtocolException
-
getLocationURI
public URI getLocationURI(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.HttpException - Specified by:
getLocationURI
in interfaceRedirectStrategy
- Throws:
org.apache.hc.core5.http.HttpException
-
createLocationURI
- Throws:
org.apache.hc.core5.http.ProtocolException
- Since:
- 4.1
-