hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David L. Crow" <c...@OrangeBlood.org>
Subject HttpMethodDirector#isRedirectNeeded() and subclasses of EntityEnclosingMethod
Date Thu, 25 May 2006 20:36:15 GMT
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
  crow@OrangeBlood.org              whole other country.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message