public class DefaultProxySelector extends java.net.ProxySelector
Modifier and Type | Field and Description |
---|---|
private java.net.ProxySelector |
delegate |
private java.util.Set<java.lang.String> |
errorMessages |
private java.util.Set<java.lang.String> |
errorResources |
private java.net.InetSocketAddress |
httpProxySocketAddress |
private static java.lang.String |
IPV4_LOOPBACK |
private static java.lang.String |
IPV6_LOOPBACK |
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 static java.util.List<java.net.Proxy> |
NO_PROXY_LIST |
private java.util.Set<java.lang.String> |
proxyExceptions |
private ProxyPreferencesPanel.ProxyPolicy |
proxyPolicy |
private java.net.InetSocketAddress |
socksProxySocketAddress |
Constructor and Description |
---|
DefaultProxySelector(java.net.ProxySelector delegate)
A typical example is:
|
Modifier and Type | Method and Description |
---|---|
void |
clearErrors()
Clear the sets of failed resources and error messages.
|
void |
connectFailed(java.net.URI uri,
java.net.SocketAddress sa,
java.io.IOException ioe) |
java.util.Set<java.lang.String> |
getErrorMessages()
Returns the set of current proxy error messages.
|
java.util.Set<java.lang.String> |
getErrorResources()
Returns the set of current proxy resources that failed to be retrieved.
|
boolean |
hasErrors()
Determines if proxy errors have occured.
|
void |
initFromPreferences()
Initializes the proxy selector from the setting in the preferences.
|
protected int |
parseProxyPortValue(java.lang.String property,
java.lang.String value) |
java.util.List<java.net.Proxy> |
select(java.net.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. |
private static final java.util.List<java.net.Proxy> NO_PROXY_LIST
private static final java.lang.String IPV4_LOOPBACK
private static final java.lang.String IPV6_LOOPBACK
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 java.net.InetSocketAddress httpProxySocketAddress
private java.net.InetSocketAddress socksProxySocketAddress
private java.net.ProxySelector delegate
private final java.util.Set<java.lang.String> errorResources
private final java.util.Set<java.lang.String> errorMessages
private java.util.Set<java.lang.String> proxyExceptions
public DefaultProxySelector(java.net.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(java.lang.String property, java.lang.String value)
public final void initFromPreferences()
public void connectFailed(java.net.URI uri, java.net.SocketAddress sa, java.io.IOException ioe)
connectFailed
in class java.net.ProxySelector
public final java.util.Set<java.lang.String> getErrorResources()
public final java.util.Set<java.lang.String> getErrorMessages()
public final void clearErrors()
public final boolean hasErrors()
true
if errors have occured, false
otherwise.public java.util.List<java.net.Proxy> select(java.net.URI uri)
select
in class java.net.ProxySelector