+
+ // proxy properties methods
+ public static void resetProxyProperties()
+ {
+ setProxyProperties(startupProxyProperties[0], startupProxyProperties[1],
+ startupProxyProperties[2], startupProxyProperties[3]);
+ StringBuilder sb = new StringBuilder();
+ sb.append("Setting proxy properties to: http.proxyHost=")
+ .append(startupProxyProperties[0]).append(", http.proxyPort=")
+ .append(startupProxyProperties[1]).append(", https.proxyHost=")
+ .append(startupProxyProperties[2]).append(", https.proxyPort=")
+ .append(startupProxyProperties[3]);
+ if (Cache.log == null)
+ {
+ System.err.println(sb.toString());
+ }
+ else
+ {
+ Cache.log.debug(sb.toString());
+ }
+ }
+
+ public static void setProxyProperties(String host, String port)
+ {
+ setProxyProperties(host, port, host, port);
+ }
+
+ public static void setProxyProperties(String httpHost, String httpPort,
+ String httpsHost, String httpsPort)
+ {
+ // cannot set property to null -- use clearProperty instead
+
+ // http.proxyHost
+ if (httpHost == null)
+ {
+ System.clearProperty("http.proxyHost");
+ }
+ else
+ {
+ System.setProperty("http.proxyHost", httpHost);
+ }
+
+ // http.proxyPort
+ if (httpPort == null)
+ {
+ System.clearProperty("http.proxyPort");
+ }
+ else
+ {
+ System.setProperty("http.proxyPort", httpPort);
+ }
+
+ // https.proxyHost
+ if (httpsHost == null)
+ {
+ System.clearProperty("https.proxyHost");
+ }
+ else
+ {
+ System.setProperty("https.proxyHost", httpsHost);
+ }
+
+ // https.proxyPort
+ if (httpsPort == null)
+ {
+ System.clearProperty("https.proxyPort");
+ }
+ else
+ {
+ System.setProperty("https.proxyPort", httpsPort);
+ }
+
+ }