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 Bashiro <ba...@myway.com> on 2007/09/14 18:24:42 UTC

User-Agent


Hello guys,
What is the code snip for editing the
"User-Agent" header in httpClient.

Thanks
Bashiro


_______________________________________________
No banners. No pop-ups. No kidding.
Make My Way  your home on the Web - http://www.myway.com



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


Re: User-Agent

Posted by Madhur Kumar Tanwani <ma...@gmail.com>.
This is what I use. This sets the user agent string for the client, and 
hence I need to do it for every method call :

HttpClientParams params = httpclient.getParams();
// Make the user agent string configurable
params.setParameter("http.useragent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0");

HTH.

Henry Chen wrote:
> GetMethod authget = new GetMethod(url);
> authget.setRequestHeader(new Header(
> 			"User-Agent",
> 			"Mozilla/5.0 (Windows; U; Windows NT 5.1; en_US;
> rv:1.8.1.4)Gecko/20070515 Firefox/2.0.0.4"));
>
>
> -----Original Message-----
> From: Bashiro [mailto:bashiro@myway.com] 
> Sent: Friday, September 14, 2007 11:25 AM
> To: httpclient-user@jakarta.apache.org
> Subject: User-Agent
>
>
>
> Hello guys,
> What is the code snip for editing the
> "User-Agent" header in httpClient.
>
> Thanks
> Bashiro
>
>
> _______________________________________________
> No banners. No pop-ups. No kidding.
> Make My Way  your home on the Web - http://www.myway.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>
>   


-- 
Madhur Kumar Tanwani <http://madhurtanwani.googlepages.com>
Gebo <http://feeds.feedburner.com/%7Er/Gebo/%7E6/1>

****************************************************************
* Imagine if every Thursday your shoes exploded if you tied them the *usual way*.
This happens to us all the time with *computers*, and nobody thinks of complaining. Johnson
****************************************************************


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


RE: User-Agent

Posted by Henry Chen <he...@gmail.com>.
GetMethod authget = new GetMethod(url);
authget.setRequestHeader(new Header(
			"User-Agent",
			"Mozilla/5.0 (Windows; U; Windows NT 5.1; en_US;
rv:1.8.1.4)Gecko/20070515 Firefox/2.0.0.4"));


-----Original Message-----
From: Bashiro [mailto:bashiro@myway.com] 
Sent: Friday, September 14, 2007 11:25 AM
To: httpclient-user@jakarta.apache.org
Subject: User-Agent



Hello guys,
What is the code snip for editing the
"User-Agent" header in httpClient.

Thanks
Bashiro


_______________________________________________
No banners. No pop-ups. No kidding.
Make My Way  your home on the Web - http://www.myway.com



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


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