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.ProxySelectordelegateprivate java.util.Set<java.lang.String>errorMessagesprivate java.util.Set<java.lang.String>errorResourcesprivate java.net.InetSocketAddresshttpProxySocketAddressprivate static java.lang.StringIPV4_LOOPBACKprivate static java.lang.StringIPV6_LOOPBACKprivate static booleanjvmWillUseSystemProxiesTheProxySelectorprovided by the JDK will retrieve proxy information from the system settings, if the system propertyjava.net.useSystemProxiesis defined at startup.private static java.util.List<java.net.Proxy>NO_PROXY_LISTstatic java.lang.StringPROXY_EXCEPTIONSProperty key for proxy exceptions liststatic java.lang.StringPROXY_HTTP_HOSTProperty key for HTTP proxy hoststatic java.lang.StringPROXY_HTTP_PORTProperty key for HTTP proxy portstatic java.lang.StringPROXY_INCLUDESProperty key for hosts that should be proxied (if this is set, only specified hosts should be proxied)static java.lang.StringPROXY_PASSProperty key for proxy passwordstatic java.lang.StringPROXY_POLICYProperty key for proxy policystatic java.lang.StringPROXY_SOCKS_HOSTProperty key for SOCKS proxy hoststatic java.lang.StringPROXY_SOCKS_PORTProperty key for SOCKS proxy portstatic java.lang.StringPROXY_USERProperty key for proxy usernameprivate java.util.Set<java.lang.String>proxyExceptionsprivate java.util.Set<java.lang.String>proxyIncludesprivate ProxyPolicyproxyPolicyprivate java.net.InetSocketAddresssocksProxySocketAddress
-
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 voidclearErrors()Clear the sets of failed resources and error messages.voidconnectFailed(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.booleanhasErrors()Determines if proxy errors have occurred.voidinitFromPreferences()Initializes the proxy selector from the setting in the preferences.protected intparseProxyPortValue(java.lang.String property, java.lang.String value)java.util.List<java.net.Proxy>select(java.net.URI uri)static booleanwillJvmRetrieveSystemProxies()TheProxySelectorprovided by the JDK will retrieve proxy information from the system settings, if the system propertyjava.net.useSystemProxiesis 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
TheProxySelectorprovided by the JDK will retrieve proxy information from the system settings, if the system propertyjava.net.useSystemProxiesis 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()
TheProxySelectorprovided by the JDK will retrieve proxy information from the system settings, if the system propertyjava.net.useSystemProxiesis defined at startup. If the property is set later by the application, this has no effect.- Returns:
- true, if
java.net.useSystemProxieswas 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:
connectFailedin 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:
trueif errors have occurred,falseotherwise.- Since:
- 6523
-
select
public java.util.List<java.net.Proxy> select(java.net.URI uri)
- Specified by:
selectin classjava.net.ProxySelector
-
-