You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Brian K. Wallace" <br...@transmorphix.com> on 2005/05/20 01:35:07 UTC

[httpclient]Re: HttpClient and User Agent string

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Luca -

Httpclient's list is httpclient-user@jakarta.apache.org but if you send
to commons-user, please prefix your messages with [httpclient] as most
people filter based on the component.

Try
~  getmethod.setRequestHeader(ua);

Hope that helps.

Brian

Luca Passani wrote:
| Hello
|
| the archives contain traces of a HttpClient specific dev mailing list,
| but it does not seem to exist anymore, so I wonder if this is the right
| place to ask.
|
| I need to build some HTTP utilities. Jakarta HttpClient seemed
| to do the job apparently, but I can't find a way to change the
| user-agent header!!!
|
| reading the JavaDocs I got as far as:
|
| getmethod = new GetMethod(url_to_get);
| Header ua = new Header("User-Agent","Mozilla/5.0 (Macintosh; U; PPC Mac
| OS X; en)");
| getmethod.USER_AGENT = ua;
|
| Alas, for reasons I can't understand, this is not permitted:
|
|    [javac] DocumentRetriever.java:110: USER_AGENT has protected access
| in org.apache.commons.httpclient.HttpMethodBase
|    [javac]         getmethod.USER_AGENT = ua;
|    [javac]                      ^
|    [javac] 1 error
|
| what am I missing?
|
| thanks
|
| luca
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
| For additional commands, e-mail: commons-user-help@jakarta.apache.org
|
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32)

iD8DBQFCjSKqaCoPKRow/gARApgMAJ9EZLaUmc9wnsDFIBIBdDZJMgTSIgCcChhU
2jan9gGPwtAj0VtNMox4Csc=
=Z+YX
-----END PGP SIGNATURE-----

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