use of jgnash.ui.net.NetworkAuthenticator in project jgnash by ccavanaugh.
the class Main method setupNetworking.
/**
* Setup the networking to handle authentication requests and work http proxies correctly.
*/
private static void setupNetworking() {
final Preferences auth = Preferences.userRoot().node(NetworkAuthenticator.NODEHTTP);
if (auth.getBoolean(NetworkAuthenticator.USEPROXY, false)) {
String proxyHost = auth.get(NetworkAuthenticator.PROXYHOST, "");
String proxyPort = auth.get(NetworkAuthenticator.PROXYPORT, "");
System.getProperties().put("http.proxyHost", proxyHost);
System.getProperties().put("http.proxyPort", proxyPort);
// this will deal with any authentication requests properly
java.net.Authenticator.setDefault(new NetworkAuthenticator());
System.out.println(ResourceUtils.getString("Message.Proxy") + proxyHost + ":" + proxyPort);
}
}
Aggregations