src/share/classes/sun/net/spi/DefaultProxySelector.java

Print this page




  78         {"http", "http.proxy", "proxy", "socksProxy"},
  79         {"https", "https.proxy", "proxy", "socksProxy"},
  80         {"ftp", "ftp.proxy", "ftpProxy", "proxy", "socksProxy"},
  81         {"gopher", "gopherProxy", "socksProxy"},
  82         {"socket", "socksProxy"}
  83     };
  84 
  85     private static final String SOCKS_PROXY_VERSION = "socksProxyVersion";
  86 
  87     private static boolean hasSystemProxies = false;
  88 
  89     static {
  90         final String key = "java.net.useSystemProxies";
  91         Boolean b = AccessController.doPrivileged(
  92             new PrivilegedAction<Boolean>() {
  93                 public Boolean run() {
  94                     return NetProperties.getBoolean(key);
  95                 }});
  96         if (b != null && b.booleanValue()) {
  97             java.security.AccessController.doPrivileged(
  98                       new sun.security.action.LoadLibraryAction("net"));





  99             hasSystemProxies = init();
 100         }
 101     }
 102 
 103     /**
 104      * How to deal with "non proxy hosts":
 105      * since we do have to generate a RegexpPool we don't want to do that if
 106      * it's not necessary. Therefore we do cache the result, on a per-protocol
 107      * basis, and change it only when the "source", i.e. the system property,
 108      * did change.
 109      */
 110 
 111     static class NonProxyInfo {
 112         // Default value for nonProxyHosts, this provides backward compatibility
 113         // by excluding localhost and its litteral notations.
 114         static final String defStringVal = "localhost|127.*|[::1]|0.0.0.0|[::0]";
 115 
 116         String hostsSource;
 117         RegexpPool hostsPool;
 118         final String property;




  78         {"http", "http.proxy", "proxy", "socksProxy"},
  79         {"https", "https.proxy", "proxy", "socksProxy"},
  80         {"ftp", "ftp.proxy", "ftpProxy", "proxy", "socksProxy"},
  81         {"gopher", "gopherProxy", "socksProxy"},
  82         {"socket", "socksProxy"}
  83     };
  84 
  85     private static final String SOCKS_PROXY_VERSION = "socksProxyVersion";
  86 
  87     private static boolean hasSystemProxies = false;
  88 
  89     static {
  90         final String key = "java.net.useSystemProxies";
  91         Boolean b = AccessController.doPrivileged(
  92             new PrivilegedAction<Boolean>() {
  93                 public Boolean run() {
  94                     return NetProperties.getBoolean(key);
  95                 }});
  96         if (b != null && b.booleanValue()) {
  97             java.security.AccessController.doPrivileged(
  98                 new java.security.PrivilegedAction<Void>() {
  99                     public Void run() {
 100                         System.loadLibrary("net");
 101                         return null;
 102                     }
 103                 });
 104             hasSystemProxies = init();
 105         }
 106     }
 107 
 108     /**
 109      * How to deal with "non proxy hosts":
 110      * since we do have to generate a RegexpPool we don't want to do that if
 111      * it's not necessary. Therefore we do cache the result, on a per-protocol
 112      * basis, and change it only when the "source", i.e. the system property,
 113      * did change.
 114      */
 115 
 116     static class NonProxyInfo {
 117         // Default value for nonProxyHosts, this provides backward compatibility
 118         // by excluding localhost and its litteral notations.
 119         static final String defStringVal = "localhost|127.*|[::1]|0.0.0.0|[::0]";
 120 
 121         String hostsSource;
 122         RegexpPool hostsPool;
 123         final String property;