throw new RedirectException("Maximum redirects ("
+ maxRedirects + ") exceeded");
}
this.redirectCount++;
final HttpUriRequest redirect = this.redirectStrategy.getRedirect(
this.currentRequest, this.currentResponse, this.localContext);
final HttpRequest orig = request.getOriginal();
redirect.setHeaders(orig.getAllHeaders());
final URI uri = redirect.getURI();
if (uri.getHost() == null) {
throw new ProtocolException("Redirect URI does not specify a valid host name: " + uri);
}
final HttpHost newTarget = new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme());