hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stijn Deknudt <st...@ebisi.be>
Subject HttpClient 4.x headers & parameters - question
Date Fri, 12 Aug 2011 14:24:03 GMT
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.

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


Mime
View raw message