Changeset 31884
- Timestamp:
- 2017-08-15T19:17:46+12:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java
r31883 r31884 1482 1482 // https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html 1483 1483 // https://stackoverflow.com/questions/14243590/proxy-settings-in-java 1484 1485 // Just need to warn the user that we're overriding proxy settings using custom defined proxy settings 1486 // and returning to using the original proxy settings when custom defined proxy settings are turned off 1487 // We don't actually need to store/restore the original settings, as Java system vars like http.proxyHost 1488 // http.proxyPort don't seem to be set even if on GLI startup the env vars like http(s)_proxy were already set. 1489 1484 1490 1485 1491 if(use_proxy) { 1486 1492 if(System.getenv(protocol+"_proxy") != null) { 1487 1493 System.err.println("Overriding original "+protocol+" proxy settings"); 1488 1489 // first store the original settings, but only if we haven't already stored them for this protocol1490 if(startup_proxy_settings.getProperty(protocol+".proxyHost") == null) {1491 ///System.err.println("@@@ Overriding with: " + System.getProperty(protocol+".proxyHost", ""));1492 startup_proxy_settings.setProperty(protocol+".proxyHost", System.getProperty(protocol+".proxyHost", ""));1493 startup_proxy_settings.setProperty(protocol+".proxyPort", System.getProperty(protocol+".proxyPort", ""));1494 1495 //if(protocol.equals("http")) {1496 //startup_proxy_settings.setProperty(protocol+".proxyType", System.getProperty(protocol+".proxyType", ""));1497 //startup_proxy_settings.setProperty(protocol+".proxySet", System.getProperty(protocol+".proxySet", ""));1498 //}1499 }1500 1494 } 1501 1495 1502 // finally can nowset the custom proxy defined through GLI for this protocol1496 // set the custom proxy defined through GLI for this protocol 1503 1497 System.setProperty(protocol+".proxyHost", Configuration.getString("general."+protocol.toUpperCase()+"_proxy_host", true)); 1504 1498 System.setProperty(protocol+".proxyPort", Configuration.getString("general."+protocol.toUpperCase()+"_proxy_port", true)); 1505 1499 1506 1500 // Not sure what proxyType is. And proxySet ceased to exist since JDK 6 or before. See links above. 1507 // But we used to set them both for HTTP before, so still doing so for proxyType whichmay or may not exist1508 // but proxySet doesn't exist anymore, so not continuing with that.1501 // But we used to set them both for HTTP before, so still doing so for proxyType, since it may or may not exist 1502 // But proxySet doesn't exist anymore, so not continuing with that. 1509 1503 if(protocol.equals("http")) { 1510 1504 System.setProperty(protocol+".proxyType", "4"); … … 1519 1513 if(System.getenv(protocol+"_proxy") != null) { 1520 1514 System.err.println("Restoring original "+protocol+" proxy settings"); 1521 System.setProperty(protocol+".proxyHost", startup_proxy_settings.getProperty(protocol+".proxyHost"));1522 System.setProperty(protocol+".proxyPort", startup_proxy_settings.getProperty(protocol+".proxyPort"));1523 1524 //if(protocol.equals("http")) {1525 //System.setProperty(protocol+".proxyHost", startup_proxy_settings.getProperty(protocol+".proxyType"));1526 //System.setProperty(protocol+".proxyPort", startup_proxy_settings.getProperty(protocol+".proxySet"));1527 //}1528 1515 } 1529 else { 1530 System.setProperty(protocol+".proxyHost", ""); 1531 System.setProperty(protocol+".proxyPort", ""); 1532 //if(protocol.equals("http")) { 1533 //System.setProperty(protocol+".proxySet", "false"); 1534 //} 1535 } 1536 1516 1517 System.setProperty(protocol+".proxyHost", ""); 1518 System.setProperty(protocol+".proxyPort", ""); 1519 //if(protocol.equals("http")) { 1520 //System.setProperty(protocol+".proxySet", "false"); 1521 //} 1537 1522 } 1538 1523 }
Note:
See TracChangeset
for help on using the changeset viewer.