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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to