@Contract(threading=STATELESS) public class DefaultRedirectStrategy extends Object implements RedirectStrategy
RedirectStrategy
.Modifier and Type | Field and Description |
---|---|
static DefaultRedirectStrategy |
INSTANCE
Default instance of
DefaultRedirectStrategy . |
Constructor and Description |
---|
DefaultRedirectStrategy() |
Modifier and Type | Method and Description |
---|---|
protected URI |
createLocationURI(String location) |
URI |
getLocationURI(org.apache.hc.core5.http.HttpRequest request,
org.apache.hc.core5.http.HttpResponse response,
org.apache.hc.core5.http.protocol.HttpContext context) |
boolean |
isRedirectAllowed(org.apache.hc.core5.http.HttpHost currentTarget,
org.apache.hc.core5.http.HttpHost newTarget,
org.apache.hc.core5.http.HttpRequest redirect,
org.apache.hc.core5.http.protocol.HttpContext context)
Determines if the given redirect should be executed or the redirect response
should be returned to the caller without further processing.
|
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.
|
public static final DefaultRedirectStrategy INSTANCE
DefaultRedirectStrategy
.public boolean isRedirectAllowed(org.apache.hc.core5.http.HttpHost currentTarget, org.apache.hc.core5.http.HttpHost newTarget, org.apache.hc.core5.http.HttpRequest redirect, org.apache.hc.core5.http.protocol.HttpContext context)
RedirectStrategy
It is legal for this method implementation to modify the redirect request in order to make it suitable for redirect execution.
isRedirectAllowed
in interface RedirectStrategy
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
RedirectStrategy
isRedirected
in interface RedirectStrategy
request
- the executed requestresponse
- the response received from the target servercontext
- the context for the request executiontrue
if the request should be redirected, false
otherwiseorg.apache.hc.core5.http.ProtocolException
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
getLocationURI
in interface RedirectStrategy
org.apache.hc.core5.http.HttpException
Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.