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 Dimitrios Christodoulakis <di...@gmail.com> on 2008/05/23 23:03:09 UTC
difference between request headers and request params
Hello, I am a new user of HTTPClient and trying to learn how to use
it. I have read the relevant primer and user guide but I am not sure
what is the difference between headers and parameters. Do they have
the same functionality for GET and POST requests? I mean does the
server processes and responds differently to headers or parameters?
I am trying to set request headers with
addRequestHeader("MyHeaderName", "MyHeaderValue"); and then after
executing the method I print the headers like:
Header[] reqheaders = authget.getRequestHeaders();
for (int i=1; i<reqheaders.length; i++) {
System.out.println(reqheaders[i].getName().toString() +" = "+
reqheaders[i].getValue().toString());
}
But no headers are displayed.
Thanks for helping
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: difference between request headers and request params
Posted by Dimitrios Christodoulakis <di...@gmail.com>.
Thank you for your quick reply. That sure helps. As I keep working and
practicing with HttpClient, I will post new questions. This seems like
a very handy tool actually.
On Sat, May 24, 2008 at 6:00 AM, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Fri, 2008-05-23 at 16:03 -0500, Dimitrios Christodoulakis wrote:
>> Hello, I am a new user of HTTPClient and trying to learn how to use
>> it. I have read the relevant primer and user guide but I am not sure
>> what is the difference between headers and parameters.
>
> HTTP headers are elements of the HTTP request sent to the target server.
> Parameters are merely attributes that affect the way HttpClient
> functions. Parameters can apply to different aspects of HttpClient, not
> just request messages.
>
>
>> Do they have
>> the same functionality for GET and POST requests?
>
> No, they do not
>
>> I mean does the
>> server processes and responds differently to headers or parameters?
>>
>
> No, it does not. The server is completely unaware of the parameters.
> They are not a part of the HTTP protocol.
>
> Hope this helps
>
> Oleg
>
>> I am trying to set request headers with
>> addRequestHeader("MyHeaderName", "MyHeaderValue"); and then after
>> executing the method I print the headers like:
>>
>> Header[] reqheaders = authget.getRequestHeaders();
>> for (int i=1; i<reqheaders.length; i++) {
>> System.out.println(reqheaders[i].getName().toString() +" = "+
>> reqheaders[i].getValue().toString());
>> }
>>
>> But no headers are displayed.
>>
>> Thanks for helping
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
Re: difference between request headers and request params
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2008-05-23 at 16:03 -0500, Dimitrios Christodoulakis wrote:
> Hello, I am a new user of HTTPClient and trying to learn how to use
> it. I have read the relevant primer and user guide but I am not sure
> what is the difference between headers and parameters.
HTTP headers are elements of the HTTP request sent to the target server.
Parameters are merely attributes that affect the way HttpClient
functions. Parameters can apply to different aspects of HttpClient, not
just request messages.
> Do they have
> the same functionality for GET and POST requests?
No, they do not
> I mean does the
> server processes and responds differently to headers or parameters?
>
No, it does not. The server is completely unaware of the parameters.
They are not a part of the HTTP protocol.
Hope this helps
Oleg
> I am trying to set request headers with
> addRequestHeader("MyHeaderName", "MyHeaderValue"); and then after
> executing the method I print the headers like:
>
> Header[] reqheaders = authget.getRequestHeaders();
> for (int i=1; i<reqheaders.length; i++) {
> System.out.println(reqheaders[i].getName().toString() +" = "+
> reqheaders[i].getValue().toString());
> }
>
> But no headers are displayed.
>
> Thanks for helping
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org