String proxyUrl = Global.getProxyValue("url");
String proxyPort = Global.getProxyValue("port");
String proxyUserid = Global.getProxyValue("userid");
String proxyPassword = Global.getProxyValue("password");
boolean proxySet = false;
QNetworkProxy proxy = new QNetworkProxy();
proxy.setType(ProxyType.HttpProxy);
if (!proxyUrl.trim().equals("")) {
System.out.println("Proxy URL found: " +proxyUrl);
proxySet = true;
proxy.setHostName(proxyUrl);
}
if (!proxyPort.trim().equals("")) {
System.out.println("Proxy Port found: " +proxyPort);
proxySet = true;
proxy.setPort(Integer.parseInt(proxyPort));
}
if (!proxyUserid.trim().equals("")) {
System.out.println("Proxy Userid found: " +proxyUserid);
proxySet = true;
proxy.setUser(proxyUserid);
}
if (!proxyPassword.trim().equals("")) {
System.out.println("Proxy URL found: " +proxyPassword);
proxySet = true;
proxy.setPassword(proxyPassword);
}
if (proxySet) {
QNetworkProxy.setApplicationProxy(proxy);
}