hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Getting all request headers sent
Date Thu, 06 May 2010 21:01:19 GMT
On Thu, 2010-05-06 at 22:22 -0700, Jurgen Voorneveld wrote:
> Hey list,
> 
> I'm writing a tool that sends multiple queries using HttpClient 4.0.1. I 
> want to store every request/response along with all the request headers 
> and response headers sent by the client in memory and show this 
> information to the user. I tried using the HttpGet.getAllHeaders() 
> method , unfortunately it doesn't contain any headers. Wireshark clearly 
> shows multiple headers being sent (a referer header that I add manually, 
> a User-Agent header I add using a RequestInterceptor and several headers 
> apparently added by the client itself).
> 
> The attachment shows the current output generated by the program. The 
> response is completely correct but the request is a mess. All the 
> headers are missing and the request line is not accurate. Any help 
> solving this problem would be great.
> 
> Thanks
> Jurgen
> 

Jurgen

The reason you are not seeing any request headers is because HttpClient
4.0 does not change the original request object. It remains immutable
throughout the request execution process. If you want to examine
properties of the final HTTP request object, you need to retrieve it
from the context as described here:

http://hc.apache.org/httpcomponents-client-4.0.1/tutorial/html/httpagent.html#d4e1056

Hope this helps

Oleg 



> ---------------------------------------------------------------------
> 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


Mime
View raw message