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 Biju P <bi...@tcs.com> on 2008/03/20 06:01:44 UTC

Handling proxies and modifying request header fields

Hi,

I am writing an Applet. The applet must be accessed by users from 
different domains and networks which are controlled by proxies and 
firewalls.

My concerns are,
i) The applet should be able to send requests to external websites thru 
the proxy (if any proxy exists).
ii) The applet should be able to modify the request header fields, such as 
User-agent field.

When I try using normal URLConnection from java.io package, the applet is 
able to inherit the proxy settings from the browser and send the requests 
thru that proxy. But, I am getting response code 403 for some of the 
sites. 

Can anybody tell me, is this possible by using Apache HttpClient?. And if 
so, please specify the version.

It would be a great help, if somebody could advise on this.

Biju P M
Mailto: biju.p@tcs.com
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



Re: Handling proxies and modifying request header fields

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2008-03-20 at 10:31 +0530, Biju P wrote:
> Hi,
> 
> I am writing an Applet. The applet must be accessed by users from 
> different domains and networks which are controlled by proxies and 
> firewalls.
> 
> My concerns are,
> i) The applet should be able to send requests to external websites thru 
> the proxy (if any proxy exists).
> ii) The applet should be able to modify the request header fields, such as 
> User-agent field.
> 
> When I try using normal URLConnection from java.io package, the applet is 
> able to inherit the proxy settings from the browser and send the requests 
> thru that proxy. But, I am getting response code 403 for some of the 
> sites. 
> 
> Can anybody tell me, is this possible by using Apache HttpClient?.

No, it is not. You have configure HttpClient manually either using
system properties or ProxySelector class if running on JRE 5.0 or newer.

Oleg

>  And if 
> so, please specify the version.
> 
> It would be a great help, if somebody could advise on this.
> 
> Biju P M
> Mailto: biju.p@tcs.com
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain 
> confidential or privileged information. If you are 
> not the intended recipient, any dissemination, use, 
> review, distribution, printing or copying of the 
> information contained in this e-mail message 
> and/or attachments to it are strictly prohibited. If 
> you have received this communication in error, 
> please notify us by reply e-mail or telephone and 
> immediately and permanently delete the message 
> and any attachments. Thank you
> 
> 


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