From 21705fdb9c8bb6f76bd3dddef4adc9e14b5aedb3 Mon Sep 17 00:00:00 2001 From: Oleg Kalnichevski Date: Tue, 8 Apr 2008 10:53:39 +0000 Subject: [PATCH] Made RoutedRequest a simple class git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@645846 13f79535-47bb-0310-9956-ffa450edef68 --- .../client/DefaultClientRequestDirector.java | 4 +- .../http/impl/client/RoutedRequest.java | 62 ++++++------------- 2 files changed, 20 insertions(+), 46 deletions(-) diff --git a/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java b/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java index 237ffb67b..39d7b6536 100644 --- a/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java +++ b/module-client/src/main/java/org/apache/http/impl/client/DefaultClientRequestDirector.java @@ -264,7 +264,7 @@ public class DefaultClientRequestDirector origWrapper.setParams(params); HttpRoute origRoute = determineRoute(target, origWrapper, context); - RoutedRequest roureq = new RoutedRequest.Impl(origWrapper, origRoute); + RoutedRequest roureq = new RoutedRequest(origWrapper, origRoute); long timeout = HttpClientParams.getConnectionManagerTimeout(params); @@ -822,7 +822,7 @@ public class DefaultClientRequestDirector wrapper.setParams(params); HttpRoute newRoute = determineRoute(newTarget, wrapper, context); - RoutedRequest newRequest = new RoutedRequest.Impl(wrapper, newRoute); + RoutedRequest newRequest = new RoutedRequest(wrapper, newRoute); if (LOG.isDebugEnabled()) { LOG.debug("Redirecting to '" + uri + "' via " + newRoute); diff --git a/module-client/src/main/java/org/apache/http/impl/client/RoutedRequest.java b/module-client/src/main/java/org/apache/http/impl/client/RoutedRequest.java index 568be0573..a3ba08af8 100644 --- a/module-client/src/main/java/org/apache/http/impl/client/RoutedRequest.java +++ b/module-client/src/main/java/org/apache/http/impl/client/RoutedRequest.java @@ -45,55 +45,29 @@ import org.apache.http.conn.routing.HttpRoute; * * @since 4.0 */ -public interface RoutedRequest { +public class RoutedRequest { + + protected final RequestWrapper request; + protected final HttpRoute route; /** - * Obtains the request. + * Creates a new routed request. * - * @return the request + * @param req the request + * @param route the route */ - RequestWrapper getRequest() - ; + public RoutedRequest(final RequestWrapper req, final HttpRoute route) { + super(); + this.request = req; + this.route = route; + } + public final RequestWrapper getRequest() { + return request; + } - /** - * Obtains the route. - * - * @return the route - */ - HttpRoute getRoute() - ; - - - /** - * Trivial default implementation of a routed request. - */ - public static class Impl implements RoutedRequest { - - protected final RequestWrapper request; - protected final HttpRoute route; - - /** - * Creates a new routed request. - * - * @param req the request - * @param rou the route - */ - public Impl(RequestWrapper req, HttpRoute rou) { - this.request = req; - this.route = rou; - } - - // non-javadoc, see interface - public final RequestWrapper getRequest() { - return request; - } - - // non-javadoc, see interface - public final HttpRoute getRoute() { - return route; - } - } // class Impl - + public final HttpRoute getRoute() { + return route; + } } // interface RoutedRequest