Hi Kamil, 

You may try the below code. It detects the proxy settings from System 
Properties and if it is "manual", it extracts the proxy list and configure 
accordingly. It works fine with IE, but no idea about other browsers.

HttpClient client = new HttpClient();
if(System.getProperty("javaplugin.proxy.config.type").trim()=="manual")
{
        String 
strProxyList=System.getProperty("javaplugin.proxy.config.list");
        if(strProxyList!=null && strProxyList.trim()!="")
        {
                String 
strHttpProxy=strProxyList.substring(strProxyList.indexOf("http=")+5, 
strProxyList.indexOf(',',strProxyList.indexOf("http=")+5)).trim();
 
client.getHostConfiguration().setProxy(strHttpProxy.substring(0,strHttpProxy.indexOf(':')),
 
Integer.parseInt(strHttpProxy.substring(strHttpProxy.indexOf(':')+1)));
                client.getState().setProxyCredentials("", 
strHttpProxy.substring(0,strHttpProxy.indexOf(':')), new 
UsernamePasswordCredentials("myusername", "mypassword"));
          }
}

Regards,
Biju P M
Mailto: [EMAIL PROTECTED]



Kamil Páral <[EMAIL PROTECTED]> 
04/16/2008 03:55 PM
Please respond to
"HttpClient User Discussion" <[email protected]>


To
[email protected]
cc

Subject
Re: HTTP packets instead of TCP packets






Kamil Páral wrote:
> Noone really knows, how to have HTTP proxy working with Commons 
> HttpClient 3.1?
>
If somebody got any idea, please CC me also to my email, I'm 
unsubscribing from the list. Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


ForwardSourceID:NT000042A2 
=====-----=====-----=====
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


Reply via email to