<< back
PD4ML: HTTP Proxy
If source HTML is behind a proxy, PD4ML can use the standard proxy settings,
defined for JVM. They can be set also in your Java code:
if (proxyHost != null && proxyHost.length() != 0 && proxyPort != 0) {
System.getProperties().setProperty("http.proxySet", "true");
System.getProperties().setProperty("http.proxyHost", proxyHost);
System.getProperties().setProperty("http.proxyPort", "" + proxyPort);
}
For older JVM (deprecated variable names):
if (proxyHost != null && proxyHost.length() != 0 && proxyPort != 0) {
System.getProperties().setProperty("proxySet", "true");
System.getProperties().setProperty("proxyHost", proxyHost);
System.getProperties().setProperty("proxyPort", "" + proxyPort);
}
The above approach has the major disadvantage - it is JVM-wide and can impact
functionality of "neighbor" Java applications.
If you need to define a proxy for PD4ML requests only, do it like that:
Map m = new HashMap();
m.put(PD4Constants.PD4ML_HTTP_PROXY, proxyHost + ":" + proxyPort);
pd4ml.setDynamicParams(m);
|