@Component
public class AutodiscoverRedirectStrategy
extends org.apache.http.impl.client.DefaultRedirectStrategy
This class does not limit redirect hops; DefaultHttpClient limits redirect hops to 100 (see ClientPNames.MAX_REDIRECTS ='http.protocol.max-redirects' in http://hc.apache.org/httpcomponents-client-ga/tutorial/pdf/httpclient-tutorial.pdf.
| Constructor and Description |
|---|
AutodiscoverRedirectStrategy() |
| Modifier and Type | Method and Description |
|---|---|
org.apache.http.client.methods.HttpUriRequest |
getRedirect(org.apache.http.HttpRequest request,
org.apache.http.HttpResponse response,
org.apache.http.protocol.HttpContext context)
Overrides behavior to follow redirects for POST messages, AND to have the redirect be a POST.
|
void |
setRequiredUriPatterns(List<String> requiredUriPatterns) |
void |
setUnsafeUriExclusionPatterns(List<String> unsafeUriExclusionPatterns) |
public void setUnsafeUriExclusionPatterns(List<String> unsafeUriExclusionPatterns)
public org.apache.http.client.methods.HttpUriRequest getRedirect(org.apache.http.HttpRequest request,
org.apache.http.HttpResponse response,
org.apache.http.protocol.HttpContext context)
throws org.apache.http.ProtocolException
DefaultRedirectStrategy is to use a GET for the redirect (though
against spec this is the de-facto standard, see
http://www.mail-archive.com/httpclient-users@hc.apache.org/msg06327.html and
http://www.alanflavell.org.uk/www/post-redirect.html).
For our application, we want to follow the redirect for a 302 as long as it is to a safe location and have the redirect be a POST.
This code is modified from http-components' http-client 4.2.5. Since we only use POST the code for the other HTTP methods has been removed to simplify this method.
getRedirect in interface org.apache.http.client.RedirectStrategygetRedirect in class org.apache.http.impl.client.DefaultRedirectStrategyrequest - Http requestresponse - Http responsecontext - Http contextorg.apache.http.ProtocolException - protocol exceptionCopyright © 2019 Apereo. All rights reserved.