For a java desktop application after we set these properties
System.setProperty("java.net.useSystemProxies","true");
System.setProperty("http.proxyHost", "1.1.1.1");
System.setProperty("http.proxyPort", "8080");
every http connection will be done through the defined proxy.
But for an applet these does not work.(In an applet viewer it does but in a browser it doesnt.) Applet always uses these settings which are defined in control panel\java\network settings\proxy settings.
How can i set the proxy in an applet? (Using proxy class in every opening connection is not a solution for me.)
Applet is signed and compiled with java 1.6
I imagine that the real reason that the System properties approach doesn't work is that by the time the applet starts, the Java runtime system has already read the properties and set up the default proxy selector.
Have you tried using ProxySelector
? Refer to section 4) of this document.
Of course, this is only likely to work when your applet is a signed applet.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With