@Contract(threading=IMMUTABLE) public class DefaultRedirectStrategy extends Object implements RedirectStrategy
RedirectStrategy. This strategy honors the restrictions
on automatic redirection of entity enclosing methods such as POST and PUT imposed by the
HTTP specification. 302 Moved Temporarily, 301 Moved Permanently and
307 Temporary Redirect status codes will result in an automatic redirect of
HEAD and GET methods only. POST and PUT methods will not be automatically redirected
as requiring user confirmation.
The restriction on automatic redirection of POST methods can be relaxed by using
LaxRedirectStrategy instead of DefaultRedirectStrategy.
LaxRedirectStrategy| Modifier and Type | Field and Description |
|---|---|
static DefaultRedirectStrategy |
INSTANCE |
static String |
REDIRECT_LOCATIONS
Deprecated.
(4.3) use
HttpClientContext.REDIRECT_LOCATIONS. |
| Constructor and Description |
|---|
DefaultRedirectStrategy() |
| Modifier and Type | Method and Description |
|---|---|
URI |
getLocationURI(HttpRequest request,
HttpResponse response,
HttpContext context) |
HttpUriRequest |
getRedirect(HttpRequest request,
HttpResponse response,
HttpContext context)
Determines the redirect location given the response from the target
server and the current request execution context and generates a new
request to be sent to the location.
|
boolean |
isRedirected(HttpRequest request,
HttpResponse response,
HttpContext context)
Determines if a request should be redirected to a new location
given the response from the target server.
|
@Deprecated public static final String REDIRECT_LOCATIONS
HttpClientContext.REDIRECT_LOCATIONS.public static final DefaultRedirectStrategy INSTANCE
public boolean isRedirected(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException
RedirectStrategyisRedirected in interface RedirectStrategyrequest - the executed requestresponse - the response received from the target servercontext - the context for the request executiontrue if the request should be redirected, false
otherwiseProtocolExceptionpublic URI getLocationURI(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException
ProtocolExceptionpublic HttpUriRequest getRedirect(HttpRequest request, HttpResponse response, HttpContext context) throws ProtocolException
RedirectStrategygetRedirect in interface RedirectStrategyrequest - the executed requestresponse - the response received from the target servercontext - the context for the request executionProtocolExceptionCopyright © 2010 - 2020 Adobe. All Rights Reserved