public class DefaultProxySelector extends ProxySelector
Modifier and Type | Field and Description |
---|---|
private ProxySelector |
delegate |
private Set<String> |
errorMessages |
private Set<String> |
errorResources |
private InetSocketAddress |
httpProxySocketAddress |
private static String |
IPV4_LOOPBACK |
private static 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 List<Proxy> |
NO_PROXY_LIST |
private Set<String> |
proxyExceptions |
private ProxyPreferencesPanel.ProxyPolicy |
proxyPolicy |
private InetSocketAddress |
socksProxySocketAddress |
Constructor and Description |
---|
DefaultProxySelector(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(URI uri,
SocketAddress sa,
IOException ioe) |
Set<String> |
getErrorMessages()
Returns the set of current proxy error messages.
|
Set<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(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 final List<Proxy> NO_PROXY_LIST
private static final String IPV4_LOOPBACK
private static final 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 InetSocketAddress httpProxySocketAddress
private InetSocketAddress socksProxySocketAddress
private ProxySelector delegate
private final Set<String> errorResources
private final Set<String> errorMessages
private Set<String> proxyExceptions
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 final void initFromPreferences()
public void connectFailed(URI uri, SocketAddress sa, IOException ioe)
connectFailed
in class ProxySelector
public final Set<String> getErrorResources()
public final Set<String> getErrorMessages()
public final void clearErrors()
public final boolean hasErrors()
true
if errors have occured, false
otherwise.