So far my research has found four distinct ways to make Java use proxies:
- Command line parameters such as -Dhttp.proxyHost
- System properties such as System.getProperties().put(“http.proxyHost”,”110.11.12.30″);
- URLConnection(Proxy proxy)
- urlConnection.setRequestProperty(…
Which one is the proper/recommended way to specify proxies (ignoring specific outside requirements that might make one way more attractive than the others) ?
If you want to rely on Java’s URLConnecion, I’d pick option three.