On Fri, 2011-08-12 at 16:24 +0200, Stijn Deknudt wrote:
> Hello,
> 
> I'm reading the documentation for the HttpClient 4.x
> (http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html).
> 
> There's a notion about Headers and Parameters, and you can specify
> them on both HttpClient as on HttpRequest (eg. HttpGet & HttpPost).
> I understand that there's a hierarchy when you specify parameters on
> HttpClient or on the AbstractHttpMessage-level.
> (http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d4e328)
> 
> But I don't understand what the difference is between adding a header
> or adding a parameter to the HttpRequest. What's eg the difference
> between:
> httpRequest.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 5.1;
> rv:2.0.1) Gecko/20100101 Firefox/4.0.1");
> and
> httpRequest.getParams().setParameter(CoreProtocolPNames.USER_AGENT,
> "Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101
> Firefox/4.0.1");
> I suppose that both methods will translate in a http request message
> that both have the same request header:
> "User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101
> Firefox/4.0.1"
> 
> All feedback is appreciated.
> 
> Kind regards,
> Stijn.
> 

Stijn

More often than not HTTP parameters represent behavioral configuration
(socket timeout, connect timeout, proxy configuration) rather than a
value of a particular HTTP header. User agent parameter is more of an
exception than a common rule.

Hope this helps

Oleg 


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to