hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: HttpMethodDirector#isRedirectNeeded() and subclasses of EntityEnclosingMethod
Date Fri, 26 May 2006 10:34:12 GMT
Sounds reasonable. I'll check the patch in if no one objects

Oleg

On Thu, 2006-05-25 at 15:36 -0500, David L. Crow wrote:
> 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:


---------------------------------------------------------------------
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