Package org.openstreetmap.josm.io
Class DefaultProxySelector
- java.lang.Object
-
- java.net.ProxySelector
-
- org.openstreetmap.josm.io.DefaultProxySelector
-
public class DefaultProxySelector extends java.net.ProxySelector
This is the default proxy selector used in JOSM.- Since:
- 2641
-
-
Field Summary
Fields Modifier and Type Field 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
jvmWillUseSystemProxies
TheProxySelector
provided by the JDK will retrieve proxy information from the system settings, if the system propertyjava.net.useSystemProxies
is defined at startup.private static java.util.List<java.net.Proxy>
NO_PROXY_LIST
static java.lang.String
PROXY_EXCEPTIONS
Property key for proxy exceptions liststatic java.lang.String
PROXY_HTTP_HOST
Property key for HTTP proxy hoststatic java.lang.String
PROXY_HTTP_PORT
Property key for HTTP proxy portstatic java.lang.String
PROXY_INCLUDES
Property key for hosts that should be proxied (if this is set, only specified hosts should be proxied)static java.lang.String
PROXY_PASS
Property key for proxy passwordstatic java.lang.String
PROXY_POLICY
Property key for proxy policystatic java.lang.String
PROXY_SOCKS_HOST
Property key for SOCKS proxy hoststatic java.lang.String
PROXY_SOCKS_PORT
Property key for SOCKS proxy portstatic java.lang.String
PROXY_USER
Property key for proxy usernameprivate java.util.Set<java.lang.String>
proxyExceptions
private java.util.Set<java.lang.String>
proxyIncludes
private ProxyPolicy
proxyPolicy
private java.net.InetSocketAddress
socksProxySocketAddress
-
Constructor Summary
Constructors Constructor Description DefaultProxySelector(java.net.ProxySelector delegate)
A typical example is:
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 occurred.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()
TheProxySelector
provided by the JDK will retrieve proxy information from the system settings, if the system propertyjava.net.useSystemProxies
is defined at startup.
-
-
-
Field Detail
-
PROXY_POLICY
public static final java.lang.String PROXY_POLICY
Property key for proxy policy- See Also:
- Constant Field Values
-
PROXY_HTTP_HOST
public static final java.lang.String PROXY_HTTP_HOST
Property key for HTTP proxy host- See Also:
- Constant Field Values
-
PROXY_HTTP_PORT
public static final java.lang.String PROXY_HTTP_PORT
Property key for HTTP proxy port- See Also:
- Constant Field Values
-
PROXY_SOCKS_HOST
public static final java.lang.String PROXY_SOCKS_HOST
Property key for SOCKS proxy host- See Also:
- Constant Field Values
-
PROXY_SOCKS_PORT
public static final java.lang.String PROXY_SOCKS_PORT
Property key for SOCKS proxy port- See Also:
- Constant Field Values
-
PROXY_USER
public static final java.lang.String PROXY_USER
Property key for proxy username- See Also:
- Constant Field Values
-
PROXY_PASS
public static final java.lang.String PROXY_PASS
Property key for proxy password- See Also:
- Constant Field Values
-
PROXY_EXCEPTIONS
public static final java.lang.String PROXY_EXCEPTIONS
Property key for proxy exceptions list- See Also:
- Constant Field Values
-
PROXY_INCLUDES
public static final java.lang.String PROXY_INCLUDES
Property key for hosts that should be proxied (if this is set, only specified hosts should be proxied)- Since:
- 18663
- See Also:
- Constant Field Values
-
NO_PROXY_LIST
private static final java.util.List<java.net.Proxy> NO_PROXY_LIST
-
IPV4_LOOPBACK
private static final java.lang.String IPV4_LOOPBACK
- See Also:
- Constant Field Values
-
IPV6_LOOPBACK
private static final java.lang.String IPV6_LOOPBACK
- See Also:
- Constant Field Values
-
jvmWillUseSystemProxies
private static boolean jvmWillUseSystemProxies
TheProxySelector
provided by the JDK will retrieve proxy information from the system settings, if the system propertyjava.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 its value.
-
proxyPolicy
private ProxyPolicy proxyPolicy
-
httpProxySocketAddress
private java.net.InetSocketAddress httpProxySocketAddress
-
socksProxySocketAddress
private java.net.InetSocketAddress socksProxySocketAddress
-
delegate
private final java.net.ProxySelector delegate
-
errorResources
private final java.util.Set<java.lang.String> errorResources
-
errorMessages
private final java.util.Set<java.lang.String> errorMessages
-
proxyExceptions
private java.util.Set<java.lang.String> proxyExceptions
-
proxyIncludes
private java.util.Set<java.lang.String> proxyIncludes
-
-
Constructor Detail
-
DefaultProxySelector
public DefaultProxySelector(java.net.ProxySelector delegate)
A typical example is:PropertySelector delegate = PropertySelector.getDefault(); PropertySelector.setDefault(new DefaultPropertySelector(delegate));
- Parameters:
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 installed
-
-
Method Detail
-
willJvmRetrieveSystemProxies
public static boolean willJvmRetrieveSystemProxies()
TheProxySelector
provided by the JDK will retrieve proxy information from the system settings, if the system propertyjava.net.useSystemProxies
is defined at startup. If the property is set later by the application, this has no effect.- Returns:
- true, if
java.net.useSystemProxies
was set to true at class initialization time
-
parseProxyPortValue
protected int parseProxyPortValue(java.lang.String property, java.lang.String value)
-
initFromPreferences
public final void initFromPreferences()
Initializes the proxy selector from the setting in the preferences.
-
connectFailed
public void connectFailed(java.net.URI uri, java.net.SocketAddress sa, java.io.IOException ioe)
- Specified by:
connectFailed
in classjava.net.ProxySelector
-
getErrorResources
public final java.util.Set<java.lang.String> getErrorResources()
Returns the set of current proxy resources that failed to be retrieved.- Returns:
- the set of current proxy resources that failed to be retrieved
- Since:
- 6523
-
getErrorMessages
public final java.util.Set<java.lang.String> getErrorMessages()
Returns the set of current proxy error messages.- Returns:
- the set of current proxy error messages
- Since:
- 6523
-
clearErrors
public final void clearErrors()
Clear the sets of failed resources and error messages.- Since:
- 6523
-
hasErrors
public final boolean hasErrors()
Determines if proxy errors have occurred.- Returns:
true
if errors have occurred,false
otherwise.- Since:
- 6523
-
select
public java.util.List<java.net.Proxy> select(java.net.URI uri)
- Specified by:
select
in classjava.net.ProxySelector
-
-