workaround network properties inconsistencies under Java Web Start
9
With Java Web Start 1.5.0 all of a sudden new proxy properties were introduced (deployment.proxy.http.host, deployment.proxy.http.port and deployment.proxy.bypass.list) valid only for the webstart environment - and if that was not enough yet, it does not support the existing proxy properties, neither the standard, nor the deprecated ones from old Java releases. To topple even that, for the bypass-list the delimiters were changed to semicolon (http.nonProxyHosts has the pipe char as delimiter) ...
String proxyHost = System.getProperty("proxyHost");
String proxyPort = System.getProperty("proxyPort");
String nonProxyHosts = System.getProperty("nonProxyHosts");
if (proxyHost != null)
{
// set standard proxy property
System.setProperty("http.proxyHost", proxyHost);
}
else if ((proxyHost = System.getProperty("http.proxyHost")) != null)
{
// standard proxy property is set -> just in case some software expects it,
// use it also for deprecated proxy property
System.setProperty("proxyHost", proxyHost);
}
else if ((proxyHost = System.getProperty("deployment.proxy.http.host")) != null)
{
// javaws proxy property is set ->
// use it also for standard and deprecated proxy property
System.setProperty("proxyHost", proxyHost);
System.setProperty("http.proxyHost", proxyHost);
}
if (proxyPort != null)
{
// set standard proxy property
System.setProperty("http.proxyPort", proxyPort);
}
else if ((proxyPort = System.getProperty("http.proxyPort")) != null)
{
// standard proxy property is set -> just in case some software expects it,
// use it also for deprecated proxy property
System.setProperty("proxyPort", proxyPort);
}
else if ((proxyPort = System.getProperty("deployment.proxy.http.port")) != null)
{
System.setProperty("proxyPort", proxyPort);
System.setProperty("http.proxyPort", proxyPort);
}
// set nonproxy hosts (deprecated and standard property)
if (nonProxyHosts == null) nonProxyHosts = System.getProperty("http.nonProxyHosts");
String proxyBypassList = System.getProperty("deployment.proxy.bypass.list");
if (nonProxyHosts == null && proxyBypassList != null)
{
nonProxyHosts = proxyBypassList.replace(';', '|');
}
nonProxyHosts = updateNonProxyHosts(isProxyEnabled(), nonProxyHosts);
if (nonProxyHosts != null)
{
System.setProperty("nonProxyHosts", nonProxyHosts);
System.setProperty("http.nonProxyHosts", nonProxyHosts);
proxyBypassList = nonProxyHosts.replace('|', ';');
System.setProperty("deployment.proxy.bypass.list", proxyBypassList);
}






There are currently no comments for this snippet.