attribute visibility and explicit ProxySelector

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@617184 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Roland Weber 2008-01-31 18:42:19 +00:00
parent 91f7ef4cef
commit 632bf9aba6
2 changed files with 35 additions and 5 deletions

View File

@ -55,7 +55,9 @@ import org.apache.http.conn.params.ConnRoutePNames;
*/ */
public class DefaultHttpRoutePlanner implements HttpRoutePlanner { public class DefaultHttpRoutePlanner implements HttpRoutePlanner {
private ClientConnectionManager connectionManager; /** The connection manager, to get at the scheme registry. */
protected ClientConnectionManager connectionManager;
public DefaultHttpRoutePlanner(ClientConnectionManager aConnManager) { public DefaultHttpRoutePlanner(ClientConnectionManager aConnManager) {
setConnectionManager(aConnManager); setConnectionManager(aConnManager);

View File

@ -63,19 +63,45 @@ import org.apache.http.conn.params.ConnRoutePNames;
*/ */
public class ProxySelectorRoutePlanner implements HttpRoutePlanner { public class ProxySelectorRoutePlanner implements HttpRoutePlanner {
private ClientConnectionManager connectionManager; /** The connection manager, to get at the scheme registry. */
protected ClientConnectionManager connectionManager;
/** The proxy selector to use, or <code>null</code> for system default. */
protected ProxySelector proxySelector;
public ProxySelectorRoutePlanner(ClientConnectionManager aConnManager) { public ProxySelectorRoutePlanner(ClientConnectionManager aConnManager) {
setConnectionManager(aConnManager); setConnectionManager(aConnManager);
} }
public void setConnectionManager(ClientConnectionManager aConnManager) { public void setConnectionManager(ClientConnectionManager aConnManager) {
this.connectionManager = aConnManager; this.connectionManager = aConnManager;
} }
/**
* Obtains the proxy selector to use.
*
* @return the proxy selector, or <code>null</code> for the system default
*/
public ProxySelector getProxySelector() {
return this.proxySelector;
}
/**
* Sets the proxy selector to use.
*
* @param psel the proxy selector, or
* <code>null</code> to use the system default
*/
public void setProxySelector(ProxySelector psel) {
this.proxySelector = psel;
}
// non-javadoc, see interface HttpRoutePlanner // non-javadoc, see interface HttpRoutePlanner
public HttpRoute determineRoute(HttpHost target, public HttpRoute determineRoute(HttpHost target,
HttpRequest request, HttpRequest request,
@ -138,7 +164,9 @@ public class ProxySelectorRoutePlanner implements HttpRoutePlanner {
throws HttpException { throws HttpException {
// the proxy selector can be 'unset', so we better deal with null here // the proxy selector can be 'unset', so we better deal with null here
final ProxySelector psel = ProxySelector.getDefault(); ProxySelector psel = this.proxySelector;
if (psel == null)
psel = ProxySelector.getDefault();
if (psel == null) if (psel == null)
return null; return null;