Re: svn commit: r787433 - /maven/site/trunk/src/site/apt/guides/mini/guide-http-settings.apt

View: New views
8 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: svn commit: r787433 - /maven/site/trunk/src/site/apt/guides/mini/guide-http-settings.apt

by brettporter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 23/06/2009, at 8:56 AM, jdcasey@... wrote:

> Author: jdcasey
> Date: Mon Jun 22 22:56:25 2009
> New Revision: 787433
>
> URL: http://svn.apache.org/viewvc?rev=787433&view=rev
> Log:
> Adding documentation for (proposed) new httpclient-based wagon  
> configuration.
>
> Added:
>    maven/site/trunk/src/site/apt/guides/mini/guide-http-
> settings.apt   (with props)
>
[...]

John,

I found the following configuration didn't work with 2.2.0:

   <servers>
     <server>
       <id>localhost</id>
       <configuration>
         <httpConfiguration>
           <get>
<useDefaultHeaders>false</useDefaultHeaders>
             <headers>
               <header>
<name>User-Agent</name>
<value>Foo-Bar/1.1</value>
               </header>
             </headers>
           </get>
         </httpConfiguration>

(I also tried without the default headers line, and with "all" instead  
of "get").

<httpHeaders/> continues to work.

What am I doing wrong?

> +  It's important to understand that the above method didn't allow  
> you to turn off the default HTTP headers; nor
> +  did it allow you to specify headers on a per-method basis.

That's not quite true, since the only default headers were the caching  
ones, which could be disabled by setting useCache to false. Would it  
be better to phrase this as "under 2.1.0 and earlier"?

> +  If all you need is a per-server timeout configuration, you still  
> have the option to use the old <<<\<timeout\>>>>
> +  parameter. If you need to separate timeout preferences according  
> to HTTP method, you can use one more like that
> +  specified directly above.

Do you think instead of deprecating the old httpHeaders/useCache that  
it could be the same recommendation? Basically - you can keep using  
the direct config, but if you need fine-grained the above is  
available. This also helps avoid issues where the lightweight vs  
httpclient configs have now diverged.

- Brett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: svn commit: r787433 - /maven/site/trunk/src/site/apt/guides/mini/guide-http-settings.apt

by John Casey-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Brett Porter wrote:

>
> On 23/06/2009, at 8:56 AM, jdcasey@... wrote:
>
>> Author: jdcasey
>> Date: Mon Jun 22 22:56:25 2009
>> New Revision: 787433
>>
>> URL: http://svn.apache.org/viewvc?rev=787433&view=rev
>> Log:
>> Adding documentation for (proposed) new httpclient-based wagon
>> configuration.
>>
>> Added:
>>    maven/site/trunk/src/site/apt/guides/mini/guide-http-settings.apt  
>> (with props)
>>
> [...]
>
> John,
>
> I found the following configuration didn't work with 2.2.0:
>
>   <servers>
>     <server>
>       <id>localhost</id>
>       <configuration>
>         <httpConfiguration>
>           <get>
> <useDefaultHeaders>false</useDefaultHeaders>
>             <headers>
>               <header>
> <name>User-Agent</name>
> <value>Foo-Bar/1.1</value>
>               </header>
>             </headers>
>           </get>
>         </httpConfiguration>
>
> (I also tried without the default headers line, and with "all" instead
> of "get").
>
> <httpHeaders/> continues to work.
>
> What am I doing wrong?

I'm guessing User-Agent needs to be documented as an exception, since we
setup User-Agent through the DefaultWagonManager (IIRC, you and I worked
on that for 2.1.0). I'm sure the logic in DefaultWagonManager overrides
what you setup above.

>
>> +  It's important to understand that the above method didn't allow you
>> to turn off the default HTTP headers; nor
>> +  did it allow you to specify headers on a per-method basis.
>
> That's not quite true, since the only default headers were the caching
> ones, which could be disabled by setting useCache to false. Would it be
> better to phrase this as "under 2.1.0 and earlier"?

I was actually referring to Accept-Encoding, which came up in one of the
WAGON issues for the -beta-6 release. From what I could tell, useCache
== false doesn't/shouldn't turn that header off...

>
>> +  If all you need is a per-server timeout configuration, you still
>> have the option to use the old <<<\<timeout\>>>>
>> +  parameter. If you need to separate timeout preferences according to
>> HTTP method, you can use one more like that
>> +  specified directly above.
>
> Do you think instead of deprecating the old httpHeaders/useCache that it
> could be the same recommendation? Basically - you can keep using the
> direct config, but if you need fine-grained the above is available. This
> also helps avoid issues where the lightweight vs httpclient configs have
> now diverged.

Sure, I don't see what it'd hurt to remove the deprecation on
httpHeaders. Since deprecation of that field isn't evident for most
Maven users (those who are configuring the wagon via settings.xml), I
suppose this could wait until the beta-7 / 1.0 release?

>
> - Brett
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@...
> For additional commands, e-mail: dev-help@...
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: svn commit: r787433 - /maven/site/trunk/src/site/apt/guides/mini/guide-http-settings.apt

by brettporter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 30/06/2009, at 1:32 AM, John Casey wrote:

>
> I'm guessing User-Agent needs to be documented as an exception,  
> since we setup User-Agent through the DefaultWagonManager (IIRC, you  
> and I worked on that for 2.1.0). I'm sure the logic in  
> DefaultWagonManager overrides what you setup above.

Odd that it works with httpHeaders but not the other. I haven't had a  
chance to confirm other headers are working properly.

>
>>> +  If all you need is a per-server timeout configuration, you  
>>> still have the option to use the old <<<\<timeout\>>>>
>>> +  parameter. If you need to separate timeout preferences  
>>> according to HTTP method, you can use one more like that
>>> +  specified directly above.
>> Do you think instead of deprecating the old httpHeaders/useCache  
>> that it could be the same recommendation? Basically - you can keep  
>> using the direct config, but if you need fine-grained the above is  
>> available. This also helps avoid issues where the lightweight vs  
>> httpclient configs have now diverged.
>
> Sure, I don't see what it'd hurt to remove the deprecation on  
> httpHeaders. Since deprecation of that field isn't evident for most  
> Maven users (those who are configuring the wagon via settings.xml),  
> I suppose this could wait until the beta-7 / 1.0 release?

Yep, I think it was more how it would be viewed in this doc...

- Brett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: svn commit: r787433 - /maven/site/trunk/src/site/apt/guides/mini/guide-http-settings.apt

by John Casey-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Okay, I'll correct the doc. I guess I'll need to look into the
User-Agent behavior more carefully to determine what's going on there.

-john

Brett Porter wrote:

>
> On 30/06/2009, at 1:32 AM, John Casey wrote:
>
>>
>> I'm guessing User-Agent needs to be documented as an exception, since
>> we setup User-Agent through the DefaultWagonManager (IIRC, you and I
>> worked on that for 2.1.0). I'm sure the logic in DefaultWagonManager
>> overrides what you setup above.
>
> Odd that it works with httpHeaders but not the other. I haven't had a
> chance to confirm other headers are working properly.
>>
>>>> +  If all you need is a per-server timeout configuration, you still
>>>> have the option to use the old <<<\<timeout\>>>>
>>>> +  parameter. If you need to separate timeout preferences according
>>>> to HTTP method, you can use one more like that
>>>> +  specified directly above.
>>> Do you think instead of deprecating the old httpHeaders/useCache that
>>> it could be the same recommendation? Basically - you can keep using
>>> the direct config, but if you need fine-grained the above is
>>> available. This also helps avoid issues where the lightweight vs
>>> httpclient configs have now diverged.
>>
>> Sure, I don't see what it'd hurt to remove the deprecation on
>> httpHeaders. Since deprecation of that field isn't evident for most
>> Maven users (those who are configuring the wagon via settings.xml), I
>> suppose this could wait until the beta-7 / 1.0 release?
>
> Yep, I think it was more how it would be viewed in this doc...
>
> - Brett
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@...
> For additional commands, e-mail: dev-help@...
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: svn commit: r787433 - /maven/site/trunk/src/site/apt/guides/mini/guide-http-settings.apt

by John Casey-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Brett Porter wrote:
>> +  It's important to understand that the above method didn't allow you
>> to turn off the default HTTP headers; nor
>> +  did it allow you to specify headers on a per-method basis.
>
> That's not quite true, since the only default headers were the caching
> ones, which could be disabled by setting useCache to false. Would it be
> better to phrase this as "under 2.1.0 and earlier"?
>


BTW, maybe I'm missing something, but I took a look at the sources in
the beta-5 tag, and this is what I found, starting
AbstractHttpClientWagon.java@400 :

     protected int execute( HttpMethod httpMethod ) throws
HttpException, IOException
     {
         int statusCode = SC_NULL;
         httpMethod.getParams().setSoTimeout( getTimeout() );
         setHeaders( httpMethod );
         statusCode = client.executeMethod( httpMethod );
         return statusCode;
     }

     protected void setHeaders( HttpMethod method )
     {
         // TODO: merge with the other headers and have some better
defaults, unify with lightweight headers
         method.addRequestHeader( "Cache-control", "no-cache" );
         method.addRequestHeader( "Cache-store", "no-store" );
         method.addRequestHeader( "Pragma", "no-cache" );
         method.addRequestHeader( "Expires", "0" );
         method.addRequestHeader( "Accept-Encoding", "gzip" );

         if ( httpHeaders != null )
         {
             for ( Iterator i = httpHeaders.keySet().iterator();
i.hasNext(); )
             {
                 String header = (String) i.next();
                 method.addRequestHeader( header,
httpHeaders.getProperty( header ) );
             }
         }
     }


I think I must be missing something; how can the above code respond to a
useCache == false setting? Or is the useCache configuration a
post-beta-5 feature that hadn't been released yet?

-john

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: svn commit: r787433 - /maven/site/trunk/src/site/apt/guides/mini/guide-http-settings.apt

by brettporter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 30/06/2009, at 10:16 AM, John Casey wrote:

>
>
> Brett Porter wrote:
>>> +  It's important to understand that the above method didn't allow  
>>> you to turn off the default HTTP headers; nor
>>> +  did it allow you to specify headers on a per-method basis.
>> That's not quite true, since the only default headers were the  
>> caching ones, which could be disabled by setting useCache to false.  
>> Would it be better to phrase this as "under 2.1.0 and earlier"?
>
>
> BTW, maybe I'm missing something, but I took a look at the sources  
> in the beta-5 tag, and this is what I found, starting  
> AbstractHttpClientWagon.java@400 :

Yay consistency :) It turns out only the lightweight one had the  
useCache flag.

Anyway, you can ignore the comment, as you pointed out there was also  
the Accept-Encoding which couldn't be disabled in either.

- Brett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: svn commit: r787433 - /maven/site/trunk/src/site/apt/guides/mini/guide-http-settings.apt

by John Casey-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well, in any case, see my changes to that document if you want...I've
removed references to deprecated configuration, and termed it more of a
general-case configuration option instead.

Brett Porter wrote:

>
> On 30/06/2009, at 10:16 AM, John Casey wrote:
>
>>
>>
>> Brett Porter wrote:
>>>> +  It's important to understand that the above method didn't allow
>>>> you to turn off the default HTTP headers; nor
>>>> +  did it allow you to specify headers on a per-method basis.
>>> That's not quite true, since the only default headers were the
>>> caching ones, which could be disabled by setting useCache to false.
>>> Would it be better to phrase this as "under 2.1.0 and earlier"?
>>
>>
>> BTW, maybe I'm missing something, but I took a look at the sources in
>> the beta-5 tag, and this is what I found, starting
>> AbstractHttpClientWagon.java@400 :
>
> Yay consistency :) It turns out only the lightweight one had the
> useCache flag.
>
> Anyway, you can ignore the comment, as you pointed out there was also
> the Accept-Encoding which couldn't be disabled in either.
>
> - Brett
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@...
> For additional commands, e-mail: dev-help@...
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: svn commit: r787433 - /maven/site/trunk/src/site/apt/guides/mini/guide-http-settings.apt

by brettporter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 30/06/2009, at 10:42 AM, John Casey wrote:

> Well, in any case, see my changes to that document if you  
> want...I've removed references to deprecated configuration, and  
> termed it more of a general-case configuration option instead.

Looks good to me - thanks!

- Brett


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...