Class 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
      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  
      static java.lang.String PROXY_EXCEPTIONS
      Property key for proxy exceptions list
      static java.lang.String PROXY_HTTP_HOST
      Property key for HTTP proxy host
      static java.lang.String PROXY_HTTP_PORT
      Property key for HTTP proxy port
      static 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 password
      static java.lang.String PROXY_POLICY
      Property key for proxy policy
      static java.lang.String PROXY_SOCKS_HOST
      Property key for SOCKS proxy host
      static java.lang.String PROXY_SOCKS_PORT
      Property key for SOCKS proxy port
      static java.lang.String PROXY_USER
      Property key for proxy username
      private 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()
      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.
      • Methods inherited from class java.net.ProxySelector

        getDefault, of, setDefault
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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()
        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. 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 class java.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 class java.net.ProxySelector