The HttpMethodDirector#isRedirectNeeded() complains if a redirect is needed and followRedirects is set to false. Since subclasses of EntityEnclosingMethod (PostMethod and PutMethod) can't set followRedirects, it seems like isRedirectNeeded should not complain if the HttpMethod is one of those.

The following diff achieves this:

Index: src/java/org/apache/commons/httpclient/HttpMethodDirector.java
===================================================================
--- src/java/org/apache/commons/httpclient/HttpMethodDirector.java (revision 409457) +++ src/java/org/apache/commons/httpclient/HttpMethodDirector.java (working copy)
@@ -46,6 +46,7 @@
import org.apache.commons.httpclient.auth.CredentialsNotAvailableException;
 import org.apache.commons.httpclient.auth.AuthScope;
 import org.apache.commons.httpclient.auth.MalformedChallengeException;
+import org.apache.commons.httpclient.methods.EntityEnclosingMethod;
 import org.apache.commons.httpclient.params.HostParams;
 import org.apache.commons.httpclient.params.HttpClientParams;
 import org.apache.commons.httpclient.params.HttpConnectionParams;
@@ -815,8 +816,9 @@
                 if (method.getFollowRedirects()) {
                     return true;
                 } else {
-                    LOG.info("Redirect requested but followRedirects is "
-                            + "disabled");
+                   if ( ! ( method instanceof EntityEnclosingMethod ) )
+ LOG.info("Redirect requested but followRedirects is "
+                                + "disabled");
                     return false;
                 }
                        default:
--
 David L. Crow                     Texas!  It's like a
 [EMAIL PROTECTED]              whole other country.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to