Save This Page
Home » openjdk-7 » sun » net » spi » [javadoc | source]
public class: DefaultProxySelector [javadoc | source]
Supports proxy settings using system properties This proxy selector provides backward compatibility with the old http protocol handler as far as how proxy is set Most of the implementation copied from the old http protocol handler Supports http/https/ftp.proxyHost, http/https/ftp.proxyPort, proxyHost, proxyPort, and http/https/ftp.nonProxyHost, and socks. NOTE: need to do gopher as well
Nested Class Summary:
static class  DefaultProxySelector.NonProxyInfo  How to deal with "non proxy hosts": since we do have to generate a RegexpPool we don't want to do that if it's not necessary. Therefore we do cache the result, on a per-protocol basis, and change it only when the "source", i.e. the system property, did change. 
Field Summary
static final  String[][] props    This is where we define all the valid System Properties we have to support for each given protocol. The format of this 2 dimensional array is : - 1 row per protocol (http, ftp, ...) - 1st element of each row is the protocol name - subsequent elements are prefixes for Host & Port properties listed in order of priority. Example: {"ftp", "ftp.proxy", "ftpProxy", "proxy", "socksProxy"}, means for FTP we try in that oder: + ftp.proxyHost & ftp.proxyPort + ftpProxyHost & ftpProxyPort + proxyHost & proxyPort + socksProxyHost & socksProxyPort Note that the socksProxy should *always* be the last on the list 
Method from Summary:
connectFailed,   select
Methods from
connectFailed,   getDefault,   select,   setDefault
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from Detail:
 public  void connectFailed(URI uri,
    SocketAddress sa,
    IOException ioe) 
 public List<Proxy> select(URI uri) 
    select() method. Where all the hard work is done. Build a list of proxies depending on URI. Since we're only providing compatibility with the system properties from previous releases (see list above), that list will always contain 1 single proxy, default being NO_PROXY.