PDA

View Full Version : Java technique for bypassing proxy doesn't work on Mac




vikasu
Aug 28, 2008, 02:09 AM
Dear All,

I wrote the following (Java) code:

List list = ProxySelector.getDefault().select(new URI("http://192.168.60.52/MyServer"));
Object obj[] = list.toArray();
for(Object alist:list)
{
Proxy proxy = (Proxy)alist;
if(proxy != null && proxy.type() != Proxy.Type.DIRECT)
{
m_bProxyRequired = true;
break;
}
}

***************************************

It works well when I give Bypass Proxy information ([System Preferences->Network -> Advanced... -> Proxies - Bypass Proxy Settings for Hosts & Domains]) as 192.168.60.52 directly.
But it fails when I give 192.168.60.* or
192.168.60/24. I mean whether there is some problem in Java ProxySelector API for Mac OS or there is some other technique for doing the same.

What I need to do is my "MyServer" can be in any range, let it can be deployed between IP 192.168.60.0 to 192.168.60.100, so for that I want to bypass IPs for this range. Now if I write even 192.168.60.* in Bypass Proxy field then also it doesn't work and works well (i.e. doesn't ask for Proxy information) for 192.168.60.52.. .

So do anybody have any such idea for this problem, or any other technique ?

Regards,
Vikas