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 |
|---|---|
| public static final DefaultRedirectStrategy | |
| private final Log | |
| public static final String | REDIRECT_LOCATIONS
Deprecated
(4.3) use
org..
|
| private final String[] | |
| public static final int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | DefaultRedirectStrategy(final String[]
The methods to redirect. redirectMethods)Constructs a new instance to redirect the given HTTP methods. |
| Modifier and Type | Method and Description |
|---|---|
| protected URI | |
| public URI | |
| public HttpUriRequest | getRedirect(final HttpRequest
the executed request request, final HttpResponse the response received from the target server response, final HttpContext the context for the request execution context)Implements org. |
| protected boolean | |
| public boolean | isRedirected(final HttpRequest
the executed request request, final HttpResponse the response received from the target server response, final HttpContext the context for the request execution context)Implements org. |
| INSTANCE | back to summary |
|---|---|
| public static final DefaultRedirectStrategy INSTANCE | |
| log | back to summary |
|---|---|
| private final Log log | |
| REDIRECT_LOCATIONS | back to summary |
|---|---|
| public static final String REDIRECT_LOCATIONS
Deprecated (4.3) use | |
| redirectMethods | back to summary |
|---|---|
| private final String[] redirectMethods | |
| SC_PERMANENT_REDIRECT | back to summary |
|---|---|
| public static final int SC_PERMANENT_REDIRECT | |
| DefaultRedirectStrategy | back to summary |
|---|---|
| public DefaultRedirectStrategy() | |
| DefaultRedirectStrategy | back to summary |
|---|---|
| public DefaultRedirectStrategy(final String[] redirectMethods) Constructs a new instance to redirect the given HTTP methods.
| |
| createLocationURI | back to summary |
|---|---|
protected URI createLocationURI(final String location) throws ProtocolException
| |
| getLocationURI | back to summary |
|---|---|
| public URI getLocationURI(final HttpRequest request, final HttpResponse response, final HttpContext context) throws ProtocolException | |
| getRedirect | back to summary |
|---|---|
| public HttpUriRequest getRedirect(final HttpRequest request, final HttpResponse response, final HttpContext context) throws ProtocolException Implements org. Doc from org. 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.
| |
| isRedirectable | back to summary |
|---|---|
protected boolean isRedirectable(final String method)
| |
| isRedirected | back to summary |
|---|---|
| public boolean isRedirected(final HttpRequest request, final HttpResponse response, final HttpContext context) throws ProtocolException Implements org. Doc from org. Determines if a request should be redirected to a new location given the response from the target server.
| |