コード例 #1
0
 /** Returns true if host is on the "don't proxy" list. */
 private boolean isNonProxyHost() {
   RegexpPool dontProxy = getDontProxy();
   if (dontProxy.match(url.getHost().toLowerCase()) != null) {
     return true;
   }
   try {
     InetAddress addr = InetAddress.getByName(url.getHost());
     String host = addr.getHostAddress();
     if (dontProxy.match(host) != null) {
       return true;
     }
   } catch (UnknownHostException ignored) {
   }
   return false;
 }
コード例 #2
0
 private RegexpPool getDontProxy() {
   RegexpPool dontProxy = new RegexpPool();
   String rawList =
       (String) AccessController.doPrivileged(new GetPropertyAction("http.nonProxyHosts"));
   if (rawList != null) {
     java.util.StringTokenizer st = new java.util.StringTokenizer(rawList, "|", false);
     try {
       while (st.hasMoreTokens()) {
         dontProxy.add(st.nextToken().toLowerCase(), new Boolean(true));
       }
     } catch (Exception e) {
       e.printStackTrace();
     }
   }
   return dontProxy;
 }