Improve followredirects logging

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@190 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2008-12-02 11:05:53 +00:00
parent b394c718c1
commit 3930fd9ace
1 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package davmail.http;
import davmail.Settings;
import davmail.tray.DavGatewayTray;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
@ -130,6 +131,7 @@ public class DavGatewayHttpClientFacade {
public static HttpMethod executeFollowRedirects(HttpClient httpClient, HttpMethod method) throws IOException {
try {
DavGatewayTray.debug("executeFollowRedirects: "+method.getURI());
httpClient.executeMethod(method);
Header location = method.getResponseHeader("Location");
int redirectCount = 0;
@ -137,8 +139,9 @@ public class DavGatewayHttpClientFacade {
&& location != null
&& isRedirect(method.getStatusCode())) {
method.releaseConnection();
method = new GetMethod(method.getResponseHeader("Location").getValue());
method = new GetMethod(location.getValue());
method.setFollowRedirects(false);
DavGatewayTray.debug("executeFollowRedirects: "+method.getURI()+" redirectCount:"+redirectCount);
httpClient.executeMethod(method);
location = method.getResponseHeader("Location");
}