Class ProxySetup
java.lang.Object
uk.ac.starlink.util.ProxySetup
A singleton class for controlling the configuration of the web
proxy system properties. The values are stored as Preferences
associated with this class and can be restored to the related
System properties "http.proxySet", "http.proxyHost",
"http.proxyPort" and nonProxyHosts and saved back again.
To enable any stored proxy setup just do:
ProxySetup.getInstance().restore();Sometime during application startup. Note that this will supercede any system properties already set (but only if any Preferences have been defined).
- Version:
- $Id$
- Author:
- Peter W. Draper
-
Method Summary
Modifier and TypeMethodDescriptionstatic ProxySetupGet a reference to the only instance of this class.Get the hosts that should not be proxied.Get the proxy host.Get the proxy port.booleanGet if proxy use is enabled.voidrestore()Restore from backing store, updating the system properties.voidsetNonProxyHosts(String nohosts) Set the hosts that shouldn't use the proxy.voidsetProxyHost(String host) Set the proxy host.voidsetProxyPort(String port) Set the proxy port.voidsetProxySet(boolean set) Set if proxy use is enabled.voidstore()Save state of system properties to backing store.
-
Method Details
-
getInstance
Get a reference to the only instance of this class. -
isProxySet
public boolean isProxySet()Get if proxy use is enabled. -
setProxySet
public void setProxySet(boolean set) Set if proxy use is enabled. -
getProxyHost
Get the proxy host. -
setProxyHost
Set the proxy host. -
getProxyPort
Get the proxy port. -
setProxyPort
Set the proxy port. -
getNonProxyHosts
Get the hosts that should not be proxied. -
setNonProxyHosts
Set the hosts that shouldn't use the proxy. Note this is a list of names, separated by |, and possibly including a wildcard, e.g. "*.dur.ac.uk|localhost". -
restore
public void restore()Restore from backing store, updating the system properties. -
store
public void store()Save state of system properties to backing store.
-