@Contract(threading=STATELESS) public class DefaultRedirectStrategy extends Object implements RedirectStrategy
RedirectStrategy.| Modifier and Type | Field and Description |
|---|---|
static DefaultRedirectStrategy |
INSTANCE
Default instance of
DefaultRedirectStrategy. |
| Constructor and Description |
|---|
DefaultRedirectStrategy()
Creates a new
DefaultRedirectStrategy with the default
DefaultSchemePortResolver.INSTANCE. |
DefaultRedirectStrategy(SchemePortResolver schemePortResolver)
Creates a new
DefaultRedirectStrategy using the given SchemePortResolver. |
| Modifier and Type | Method and Description |
|---|---|
protected URI |
createLocationURI(String location) |
URI |
getLocationURI(HttpRequest request,
HttpResponse response,
HttpContext context) |
boolean |
isRedirectAllowed(HttpHost currentTarget,
HttpHost newTarget,
HttpRequest redirect,
HttpContext context)
Determines if the given redirect should be executed or the redirect response
should be returned to the caller without further processing.
|
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 DefaultRedirectStrategy INSTANCE
DefaultRedirectStrategy.public DefaultRedirectStrategy(SchemePortResolver schemePortResolver)
DefaultRedirectStrategy using the given SchemePortResolver.
If schemePortResolver is null, this will default to
DefaultSchemePortResolver.INSTANCE.schemePortResolver - the resolver to use for determining default portspublic DefaultRedirectStrategy()
DefaultRedirectStrategy with the default
DefaultSchemePortResolver.INSTANCE.public boolean isRedirectAllowed(HttpHost currentTarget, HttpHost newTarget, HttpRequest redirect, HttpContext context)
RedirectStrategyIt is legal for this method implementation to modify the redirect request in order to make it suitable for redirect execution.
isRedirectAllowed in interface RedirectStrategypublic 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 HttpException
getLocationURI in interface RedirectStrategyHttpExceptionprotected URI createLocationURI(String location) throws ProtocolException
ProtocolExceptionCopyright © 1999–2021 The Apache Software Foundation. All rights reserved.