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
This commit is contained in:
parent
e127f2278d
commit
18fc621d22
|
@ -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.
|
||||
* <p>
|
||||
* 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}.
|
||||
* </p>
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue