You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Oleg Kalnichevski <ol...@apache.org> on 2006/05/26 12:34:12 UTC

Re: HttpMethodDirector#isRedirectNeeded() and subclasses of EntityEnclosingMethod

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


Re: HttpMethodDirector#isRedirectNeeded() and subclasses of EntityEnclosingMethod

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2006-05-26 at 13:06 +0100, sebb wrote:
> I'd like to suggest removing the log message entirely ... I'm not sure
> what purpose it serves.
> 
> In JMeter, it can be useful to handle redirects, rather than letting
> the http handler deal with them.
> 
> We then get these log messages which can't easily be suppressed.
> For JMeter they don't offer any value.
> 

Done.

Oleg


> S.
> On 26/05/06, Oleg Kalnichevski <ol...@apache.org> wrote:
> > 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
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 


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


Re: HttpMethodDirector#isRedirectNeeded() and subclasses of EntityEnclosingMethod

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2006-05-26 at 13:06 +0100, sebb wrote:
> I'd like to suggest removing the log message entirely ... I'm not sure
> what purpose it serves.
> 
> In JMeter, it can be useful to handle redirects, rather than letting
> the http handler deal with them.
> 
> We then get these log messages which can't easily be suppressed.
> For JMeter they don't offer any value.
> 

Fair enough. I'll get rid of this log message entirely

Oleg 


> S.
> On 26/05/06, Oleg Kalnichevski <ol...@apache.org> wrote:
> > 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
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 


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


Re: HttpMethodDirector#isRedirectNeeded() and subclasses of EntityEnclosingMethod

Posted by sebb <se...@gmail.com>.
I'd like to suggest removing the log message entirely ... I'm not sure
what purpose it serves.

In JMeter, it can be useful to handle redirects, rather than letting
the http handler deal with them.

We then get these log messages which can't easily be suppressed.
For JMeter they don't offer any value.

S.
On 26/05/06, Oleg Kalnichevski <ol...@apache.org> wrote:
> 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
>
>

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