From 18fc621d22afcd7153d793b5713fd461708d8ba0 Mon Sep 17 00:00:00 2001 From: Roland Weber Date: Sat, 22 Dec 2007 14:24:30 +0000 Subject: [PATCH] HTTPCLIENT-716: removed context lookup for forced route git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@606453 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/http/conn/params/ConnRoutePNames.java | 5 +---- .../http/impl/conn/DefaultHttpRoutePlanner.java | 16 ++++------------ .../impl/conn/ProxySelectorRoutePlanner.java | 13 ++----------- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/module-client/src/main/java/org/apache/http/conn/params/ConnRoutePNames.java b/module-client/src/main/java/org/apache/http/conn/params/ConnRoutePNames.java index ffc4ee38b..c1312b227 100644 --- a/module-client/src/main/java/org/apache/http/conn/params/ConnRoutePNames.java +++ b/module-client/src/main/java/org/apache/http/conn/params/ConnRoutePNames.java @@ -68,16 +68,13 @@ public interface ConnRoutePNames { /** * Parameter for an forced route. - * The forced route can be set as a parameter or a context attribute. - * If both are present, the context attribute takes precedence. * The forced route will be interpreted by the standard * {@link org.apache.http.conn.HttpRoutePlanner HttpRoutePlanner} * implementations. * Instead of computing a route, the given forced route will be * returned, even if it points to the wrong target host. *

- * This parameter or context attribute should be used with care. - * It expects a value of type + * This parameter expects a value of type * {@link org.apache.http.conn.HttpRoute HttpRoute}. *

*/ diff --git a/module-client/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java b/module-client/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java index c504a23c6..7e4d75034 100644 --- a/module-client/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java +++ b/module-client/src/main/java/org/apache/http/impl/conn/DefaultHttpRoutePlanner.java @@ -50,7 +50,8 @@ import org.apache.http.conn.params.ConnRoutePNames; /** * Default implementation of an {@link HttpRoutePlanner}. * This implementation is based on {@link ConnRoutePNames parameters}. - * It will not make use of any Java system properties. + * It will not make use of any Java system properties, + * nor of system or browser proxy settings. */ public class DefaultHttpRoutePlanner implements HttpRoutePlanner { @@ -81,17 +82,8 @@ public class DefaultHttpRoutePlanner implements HttpRoutePlanner { } // If we have a forced route, we can do without a target. - // Check the context first, it might have been set by a retry handler. - HttpRoute route = null; - if (context != null) { - route = (HttpRoute) - context.getAttribute(ConnRoutePNames.FORCED_ROUTE); - } - if (route == null) { - route = (HttpRoute) - request.getParams().getParameter(ConnRoutePNames.FORCED_ROUTE); - } - + HttpRoute route = (HttpRoute) + request.getParams().getParameter(ConnRoutePNames.FORCED_ROUTE); if (route != null) return route; diff --git a/module-client/src/main/java/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java b/module-client/src/main/java/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java index 79ba2185d..9fad1c45f 100644 --- a/module-client/src/main/java/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java +++ b/module-client/src/main/java/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java @@ -90,17 +90,8 @@ public class ProxySelectorRoutePlanner implements HttpRoutePlanner { } // If we have a forced route, we can do without a target. - // Check the context first, it might have been set by a retry handler. - HttpRoute route = null; - if (context != null) { - route = (HttpRoute) - context.getAttribute(ConnRoutePNames.FORCED_ROUTE); - } - if (route == null) { - route = (HttpRoute) - request.getParams().getParameter(ConnRoutePNames.FORCED_ROUTE); - } - + HttpRoute route = (HttpRoute) + request.getParams().getParameter(ConnRoutePNames.FORCED_ROUTE); if (route != null) return route;