@Contract(threading=IMMUTABLE)
public class DefaultRedirectStrategy
extends java.lang.Object
implements org.apache.http.client.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 java.lang.String |
REDIRECT_LOCATIONS
Deprecated.
(4.3) use
HttpClientContext.REDIRECT_LOCATIONS. |
| Constructor and Description |
|---|
DefaultRedirectStrategy() |
| Modifier and Type | Method and Description |
|---|---|
protected java.net.URI |
createLocationURI(java.lang.String location) |
java.net.URI |
getLocationURI(HttpRequest request,
HttpResponse response,
org.apache.http.protocol.HttpContext context) |
HttpUriRequest |
getRedirect(HttpRequest request,
HttpResponse response,
org.apache.http.protocol.HttpContext context) |
protected boolean |
isRedirectable(java.lang.String method) |
boolean |
isRedirected(HttpRequest request,
HttpResponse response,
org.apache.http.protocol.HttpContext context) |
@Deprecated public static final java.lang.String REDIRECT_LOCATIONS
HttpClientContext.REDIRECT_LOCATIONS.public static final DefaultRedirectStrategy INSTANCE
public boolean isRedirected(HttpRequest request, HttpResponse response, org.apache.http.protocol.HttpContext context) throws ProtocolException
isRedirected in interface org.apache.http.client.RedirectStrategyProtocolExceptionpublic java.net.URI getLocationURI(HttpRequest request, HttpResponse response, org.apache.http.protocol.HttpContext context) throws ProtocolException
ProtocolExceptionprotected java.net.URI createLocationURI(java.lang.String location)
throws ProtocolException
ProtocolExceptionprotected boolean isRedirectable(java.lang.String method)
public HttpUriRequest getRedirect(HttpRequest request, HttpResponse response, org.apache.http.protocol.HttpContext context) throws ProtocolException
getRedirect in interface org.apache.http.client.RedirectStrategyProtocolException