
Set proxy parameters via script or API
Some organisations use proxies in their IT environment to protect the IT infrastructure and control the data flow between the user and the world wide web. To enable jBEAM to use this settings (e.g. when using the map service, which downloads images from the map service servers) you can choose between applying the system default settings (for Windows machines these settings are defined via the application "Internet Explorer") or using customized proxy settings.
Below is an example on how to set a custom proxy:
import com.AMS.jbeam_utils.io.*;
import com.AMS.jbeam_utils.io.ProxyProvider.ProxyParameters;
// create new proxy parameters
ProxyParameters proxyParameters = new ProxyParameters();
proxyParameters.setProxyHost("my-proxy-host");
proxyParameters.setProxyPort(8080);
// is proxy uses authentification we can provide username and password here
proxyParameters.setWithAuthentification(true);
proxyParameters.setUserName("my-proxy-user");
proxyParameters.setPassword("my-proxy-password");
// set proxy parameters and enable usage of custom proxy
ProxyProvider proxyProvider = ProxyProvider.getInstance();
proxyProvider.setCustomProxyParameters(proxyParameters);
proxyProvider.setUseCustomProxy(true);
Alternatively you can enable the usage of the system default proxy:
import com.AMS.jbeam_utils.io.ProxyProvider;
// enable usage of system proxy
ProxyProvider proxyProvider = ProxyProvider.getInstance();
proxyProvider.setUseSystemProxy(true);
If you enable the system default jBEAM automatically disables the custom proxy settings and vice versa.