@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 String |
REDIRECT_LOCATIONS |
| Constructor and Description |
|---|
DefaultRedirectStrategy() |
| Modifier and Type | Method and Description |
|---|---|
protected URI |
createLocationURI(String location) |
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.
|
protected boolean |
isRedirectable(String method) |
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.
|
public static final String REDIRECT_LOCATIONS
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
ProtocolExceptionprotected URI createLocationURI(String location) throws ProtocolException
ProtocolExceptionprotected boolean isRedirectable(String method)
public 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 © 1999–2013 The Apache Software Foundation. All rights reserved.