public class DefaultProxySelector extends ProxySelector
Modifier and Type | Field and Description |
---|---|
private ProxySelector |
delegate |
private InetSocketAddress |
httpProxySocketAddress |
private static boolean |
JVM_WILL_USE_SYSTEM_PROXIES
The
ProxySelector provided by the JDK will retrieve proxy information
from the system settings, if the system property java.net.useSystemProxies
is defined at startup. |
private ProxyPreferencesPanel.ProxyPolicy |
proxyPolicy |
private InetSocketAddress |
socksProxySocketAddress |
Constructor and Description |
---|
DefaultProxySelector(ProxySelector delegate)
A typical example is:
PropertySelector delegate = PropertySelector.getDefault();
PropertySelector.setDefault(new DefaultPropertySelector(delegate));
|
Modifier and Type | Method and Description |
---|---|
void |
connectFailed(URI uri,
SocketAddress sa,
IOException ioe) |
void |
initFromPreferences()
Initializes the proxy selector from the setting in the preferences.
|
protected int |
parseProxyPortValue(String property,
String value) |
List<Proxy> |
select(URI uri) |
static boolean |
willJvmRetrieveSystemProxies()
The
ProxySelector provided by the JDK will retrieve proxy information
from the system settings, if the system property java.net.useSystemProxies
is defined at startup. |
getDefault, setDefault
private static boolean JVM_WILL_USE_SYSTEM_PROXIES
ProxySelector
provided by the JDK will retrieve proxy information
from the system settings, if the system property java.net.useSystemProxies
is defined at startup. It has no effect if the property is set
later by the application.
We therefore read the property at class loading time and remember it's value.private ProxyPreferencesPanel.ProxyPolicy proxyPolicy
private InetSocketAddress httpProxySocketAddress
private InetSocketAddress socksProxySocketAddress
private ProxySelector delegate
public DefaultProxySelector(ProxySelector delegate)
PropertySelector delegate = PropertySelector.getDefault(); PropertySelector.setDefault(new DefaultPropertySelector(delegate));
delegate
- the proxy selector to delegate to if system settings are used. Usually
this is the proxy selector found by ProxySelector.getDefault() before this proxy
selector is installedpublic static boolean willJvmRetrieveSystemProxies()
ProxySelector
provided by the JDK will retrieve proxy information
from the system settings, if the system property java.net.useSystemProxies
is defined at startup. If the property is set later by the application,
this has no effect.protected int parseProxyPortValue(String property, String value)
public void initFromPreferences()
public void connectFailed(URI uri, SocketAddress sa, IOException ioe)
connectFailed
in class ProxySelector