Package org.openstreetmap.josm.io
Class DefaultProxySelector
- java.lang.Object
-
- java.net.ProxySelector
-
- org.openstreetmap.josm.io.DefaultProxySelector
-
public class DefaultProxySelector extends ProxySelector
This is the default proxy selector used in JOSM.- Since:
- 2641
-
-
Field Summary
Fields Modifier and Type Field 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
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 List<Proxy>
NO_PROXY_LIST
static String
PROXY_EXCEPTIONS
Property key for proxy exceptions liststatic String
PROXY_HTTP_HOST
Property key for HTTP proxy hoststatic String
PROXY_HTTP_PORT
Property key for HTTP proxy portstatic String
PROXY_PASS
Property key for proxy passwordstatic String
PROXY_POLICY
Property key for proxy policystatic String
PROXY_SOCKS_HOST
Property key for SOCKS proxy hoststatic String
PROXY_SOCKS_PORT
Property key for SOCKS proxy portstatic String
PROXY_USER
Property key for proxy usernameprivate Set<String>
proxyExceptions
private ProxyPolicy
proxyPolicy
private InetSocketAddress
socksProxySocketAddress
-
Constructor Summary
Constructors Constructor Description DefaultProxySelector(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(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 occurred.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()
TheProxySelector
provided by the JDK will retrieve proxy information from the system settings, if the system propertyjava.net.useSystemProxies
is defined at startup.-
Methods inherited from class java.net.ProxySelector
getDefault, of, setDefault
-
-
-
-
Field Detail
-
PROXY_POLICY
public static final String PROXY_POLICY
Property key for proxy policy- See Also:
- Constant Field Values
-
PROXY_HTTP_HOST
public static final String PROXY_HTTP_HOST
Property key for HTTP proxy host- See Also:
- Constant Field Values
-
PROXY_HTTP_PORT
public static final String PROXY_HTTP_PORT
Property key for HTTP proxy port- See Also:
- Constant Field Values
-
PROXY_SOCKS_HOST
public static final String PROXY_SOCKS_HOST
Property key for SOCKS proxy host- See Also:
- Constant Field Values
-
PROXY_SOCKS_PORT
public static final String PROXY_SOCKS_PORT
Property key for SOCKS proxy port- See Also:
- Constant Field Values
-
PROXY_USER
public static final String PROXY_USER
Property key for proxy username- See Also:
- Constant Field Values
-
PROXY_PASS
public static final String PROXY_PASS
Property key for proxy password- See Also:
- Constant Field Values
-
PROXY_EXCEPTIONS
public static final String PROXY_EXCEPTIONS
Property key for proxy exceptions list- See Also:
- Constant Field Values
-
NO_PROXY_LIST
private static final List<Proxy> NO_PROXY_LIST
-
IPV4_LOOPBACK
private static final String IPV4_LOOPBACK
- See Also:
- Constant Field Values
-
IPV6_LOOPBACK
private static final 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 it's value.
-
proxyPolicy
private ProxyPolicy proxyPolicy
-
httpProxySocketAddress
private InetSocketAddress httpProxySocketAddress
-
socksProxySocketAddress
private InetSocketAddress socksProxySocketAddress
-
delegate
private final ProxySelector delegate
-
errorResources
private final Set<String> errorResources
-
errorMessages
private final Set<String> errorMessages
-
proxyExceptions
private Set<String> proxyExceptions
-
-
Constructor Detail
-
DefaultProxySelector
public DefaultProxySelector(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(String property, String value)
-
initFromPreferences
public final void initFromPreferences()
Initializes the proxy selector from the setting in the preferences.
-
connectFailed
public void connectFailed(URI uri, SocketAddress sa, IOException ioe)
- Specified by:
connectFailed
in classProxySelector
-
getErrorResources
public final Set<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 Set<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
-
-