| java.lang.Object java.net.ProxySelector
All known Subclasses: java.net.ProxySelectorImpl,
ProxySelector | abstract public class ProxySelector (Code) | |
Selects applicable proxies when connecting to network resouce represented by
a URI . An implementation of ProxySelector
should be a concrete subclass of ProxySelector . Method
select returns a list of proxies according to the
uri . If a connection can't be established, the caller should
notify proxy selector by invoking connectFailed method.
A proxy selector can be registered/unregistered by calling
setDefault method and retrieved by calling
getDefault method.
|
ProxySelector | public ProxySelector()(Code) | | Constructor method.
|
connectFailed | abstract public void connectFailed(URI uri, SocketAddress sa, IOException ioe)(Code) | | If the connection can not be established to the proxy server, this method
will be called. An implementation may adjust proxy the sequence of
proxies returned by select(String, String) .
Parameters: uri - the URI that the connection fails to connectto. Parameters: sa - SocketAddress of the proxy. Parameters: ioe - The IOException which is thrown duringconnection establishment. throws: IllegalArgumentException - If any argument is null. |
getDefault | public static ProxySelector getDefault()(Code) | | Gets system default ProxySelector .
system default ProxySelector . throws: SecurtiyException - If a security manager is installed and it doesn't haveNetPermission("getProxySelector") . |
select | abstract public List<Proxy> select(URI uri)(Code) | | Gets applicable proxies based on the accessing protocol of
uri . The format of URI is defined as below:
http URI stands for http connection.
https URI stands for https connection.
ftp URI stands for ftp connection.
socket:://ip:port URI stands for tcp client sockets connection.
Parameters: uri - the destination URI object. a list contains all applicable proxies. If no proxy is available,returns a list only contains one elementProxy.NO_PROXY . throws: IllegalArgumentException - If any argument is null. |
setDefault | public static void setDefault(ProxySelector selector)(Code) | | Sets system default ProxySelector . Unsets system default
ProxySelector if selector is null.
throws: SecurtiyException - If a security manager is installed and it doesn't haveNetPermission("setProxySelector") . |
|
|