protected void resetClientForRedirect()
throws XmlRpcException {
//get the location header to find out where to redirect to
Header locationHeader = method.getResponseHeader("location");
if (locationHeader == null) {
throw new XmlRpcException("Invalid redirect: Missing location header");
}
String location = locationHeader.getValue();
URI redirectUri = null;
URI currentUri = null;
try {
currentUri = method.getURI();
String charset = currentUri.getProtocolCharset();
redirectUri = new URI(location, true, charset);
method.setURI(redirectUri);
} catch (URIException ex) {
throw new XmlRpcException(ex.getMessage(), ex);
}
//And finally invalidate the actual authentication scheme
method.getHostAuthState().invalidate();
}