final HttpRequest currentRequest = state.getCurrentRequest();
final HttpResponse currentResponse = state.getCurrentResponse();
if (this.redirectStrategy.isRedirected(currentRequest, currentResponse, localContext)) {
final int maxRedirects = config.getMaxRedirects() >= 0 ? config.getMaxRedirects() : 100;
if (state.getRedirectCount() >= maxRedirects) {
throw new RedirectException("Maximum redirects (" + maxRedirects + ") exceeded");
}
state.incrementRedirectCount();
final HttpUriRequest redirect = this.redirectStrategy.getRedirect(currentRequest, currentResponse,
localContext);
state.setRedirect(redirect);