|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.http.impl.client.DefaultRedirectStrategy
@Contract(threading=IMMUTABLE) public class DefaultRedirectStrategy
Default implementation of 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
Field Summary | |
---|---|
static DefaultRedirectStrategy |
INSTANCE
|
static String |
REDIRECT_LOCATIONS
Deprecated. (4.3) use HttpClientContext.REDIRECT_LOCATIONS . |
static int |
SC_PERMANENT_REDIRECT
|
Constructor Summary | |
---|---|
DefaultRedirectStrategy()
|
|
DefaultRedirectStrategy(String[] redirectMethods)
Constructs a new instance to redirect the given HTTP methods. |
Method Summary | |
---|---|
protected URI |
createLocationURI(String location)
|
URI |
getLocationURI(org.apache.http.HttpRequest request,
org.apache.http.HttpResponse response,
org.apache.http.protocol.HttpContext context)
|
HttpUriRequest |
getRedirect(org.apache.http.HttpRequest request,
org.apache.http.HttpResponse response,
org.apache.http.protocol.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(org.apache.http.HttpRequest request,
org.apache.http.HttpResponse response,
org.apache.http.protocol.HttpContext context)
Determines if a request should be redirected to a new location given the response from the target server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int SC_PERMANENT_REDIRECT
@Deprecated public static final String REDIRECT_LOCATIONS
HttpClientContext.REDIRECT_LOCATIONS
.public static final DefaultRedirectStrategy INSTANCE
Constructor Detail |
---|
public DefaultRedirectStrategy()
public DefaultRedirectStrategy(String[] redirectMethods)
redirectMethods
- The methods to redirect.Method Detail |
---|
public boolean isRedirected(org.apache.http.HttpRequest request, org.apache.http.HttpResponse response, org.apache.http.protocol.HttpContext context) throws org.apache.http.ProtocolException
RedirectStrategy
isRedirected
in interface RedirectStrategy
request
- the executed requestresponse
- the response received from the target servercontext
- the context for the request execution
true
if the request should be redirected, false
otherwise
org.apache.http.ProtocolException
public URI getLocationURI(org.apache.http.HttpRequest request, org.apache.http.HttpResponse response, org.apache.http.protocol.HttpContext context) throws org.apache.http.ProtocolException
org.apache.http.ProtocolException
protected URI createLocationURI(String location) throws org.apache.http.ProtocolException
org.apache.http.ProtocolException
protected boolean isRedirectable(String method)
public HttpUriRequest getRedirect(org.apache.http.HttpRequest request, org.apache.http.HttpResponse response, org.apache.http.protocol.HttpContext context) throws org.apache.http.ProtocolException
RedirectStrategy
getRedirect
in interface RedirectStrategy
request
- the executed requestresponse
- the response received from the target servercontext
- the context for the request execution
org.apache.http.ProtocolException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |