public class

DefaultProxySelector

extends ProxySelector
java.lang.Object
   ↳ java.net.ProxySelector
     ↳ sun.net.spi.DefaultProxySelector

Class Overview

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

Summary

Public Constructors
DefaultProxySelector()
Public Methods
void connectFailed(URI uri, SocketAddress sa, IOException ioe)
Called to indicate that a connection could not be established to a proxy/socks server.
List<Proxy> select(URI uri)
select() method.
[Expand]
Inherited Methods
From class java.net.ProxySelector
From class java.lang.Object

Public Constructors

public DefaultProxySelector ()

Public Methods

public void connectFailed (URI uri, SocketAddress sa, IOException ioe)

Called to indicate that a connection could not be established to a proxy/socks server. An implementation of this method can temporarily remove the proxies or reorder the sequence of proxies returned by select(URI), using the address and the IOException caught when trying to connect.

Parameters
uri The URI that the proxy at sa failed to serve.
sa The socket address of the proxy/SOCKS server
ioe The I/O exception thrown when the connect failed.

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.

Parameters
uri The URI that a connection is required to
Returns
  • a List of Proxies. Each element in the the List is of type Proxy; when no proxy is available, the list will contain one element of type Proxy that represents a direct connection.