Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Proxy automatic configuration with PAC script file

843790Jun 11 2009 — edited Jul 21 2009
Dears,

Regarding HTTP communications, I would like to auto-detect proxy settings based on system settings.
I can get information on manually configured proxy, using the following code:
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;

public class Test {

	public static void main(String[] args) {
		System.setProperty("java.net.useSystemProxies", "true");
		try {
			List<Proxy> list = ProxySelector.getDefault().select(new URI("http://www.google.be/"));
			for(int i=0; i<list.size(); i++){
				System.out.println(list.get(i));
			}
		} catch (URISyntaxException e) {
			e.printStackTrace();
		}
	}
}
But ...

I haven't found a way yet to get proxy information from automatic proxy configuration script (pac files).

Has anyone encountered/solved this problem yet?

Many thanks for your help,

Eric
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 18 2009
Added on Jun 11 2009
3 comments
606 views