hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rola...@apache.org
Subject svn commit: r603977 - in /jakarta/httpcomponents/httpclient/trunk/module-client/src: examples/org/apache/http/examples/client/ main/java/org/apache/http/client/ main/java/org/apache/http/impl/client/ test/java/org/apache/http/client/protocol/ test/java...
Date Thu, 13 Dec 2007 18:54:52 GMT
Author: rolandw
Date: Thu Dec 13 10:54:50 2007
New Revision: 603977

URL: http://svn.apache.org/viewvc?rev=603977&view=rev
Log:
HTTPCLIENT-715: changed more tests and examples to not use RoutedRequest

Modified:
    jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/HttpClient.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/protocol/TestCookie2Support.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestRequestWrapper.java

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java?rev=603977&r1=603976&r2=603977&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java
Thu Dec 13 10:54:50 2007
@@ -39,13 +39,12 @@
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpVersion;
 import org.apache.http.client.HttpClient;
-import org.apache.http.client.RoutedRequest;
 import org.apache.http.conn.ClientConnectionManager;
-import org.apache.http.conn.HttpRoute;
 import org.apache.http.conn.PlainSocketFactory;
 import org.apache.http.conn.Scheme;
 import org.apache.http.conn.SchemeRegistry;
 import org.apache.http.conn.SocketFactory;
+import org.apache.http.conn.params.ConnRoutePNames;
 import org.apache.http.conn.ssl.SSLSocketFactory;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
@@ -101,17 +100,14 @@
 
         HttpClient client = createHttpClient();
 
+        client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
+
         HttpRequest req = createRequest();
 
-        final HttpRoute route = new HttpRoute
-            (target, null, proxy,
-             supportedSchemes.getScheme(target).isLayered());
-        final RoutedRequest roureq = new RoutedRequest.Impl(req, route);
-        
         System.out.println("executing request to " + target + " via " + proxy);
         HttpEntity entity = null;
         try {
-            HttpResponse rsp = client.execute(roureq, null);
+            HttpResponse rsp = client.execute(target, req, null);
             entity = rsp.getEntity();
 
             System.out.println("----------------------------------------");

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java?rev=603977&r1=603976&r2=603977&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java
Thu Dec 13 10:54:50 2007
@@ -36,6 +36,7 @@
 import org.apache.http.client.RoutedRequest;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.conn.HttpRoute;
+import org.apache.http.conn.params.ConnRoutePNames;
 import org.apache.http.impl.client.DefaultHttpClient;
 
 /**
@@ -54,16 +55,17 @@
 
         HttpHost targetHost = new HttpHost("www.verisign.com", 443, "https"); 
         HttpHost proxy = new HttpHost("localhost", 8080); 
-        HttpRoute route = new HttpRoute(targetHost, null, proxy, true);
+
+        httpclient.getParams().setParameter
+            (ConnRoutePNames.DEFAULT_PROXY, proxy);
 
         HttpGet httpget = new HttpGet("/");
         
-        RoutedRequest routedReq = new RoutedRequest.Impl(httpget, route); 
-
         System.out.println("executing request: " + httpget.getRequestLine());
-        System.out.println("using route: " + route);
+        System.out.println("via proxy: " + proxy);
+        System.out.println("to target: " + targetHost);
         
-        HttpResponse response = httpclient.execute(routedReq, null);
+        HttpResponse response = httpclient.execute(targetHost, httpget, null);
         HttpEntity entity = response.getEntity();
 
         System.out.println("----------------------------------------");

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/HttpClient.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/HttpClient.java?rev=603977&r1=603976&r2=603977&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/HttpClient.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/HttpClient.java
Thu Dec 13 10:54:50 2007
@@ -195,28 +195,4 @@
         ;
 
 
-
-    /**
-     * Executes a request along the given route.
-     *
-     * @param roureq    the request to execute along with the route
-     * @param context   the context to use for the execution, or
-     *                  <code>null</code> to use the
-     *                  {@link #getDefaultContext default context}
-     *
-     * @return  the response to the request. See
-     *          {@link #execute(HttpUriRequest,HttpContext)}
-     *          for details.
-     *
-     * @deprecated pass just the target instead of a route
-     *
-     * @throws HttpException    in case of a problem
-     * @throws IOException      in case of an IO problem
-     * @throws InterruptedException     in case of an interrupt
-     * <br/><i @@@>timeout exceptions?</i>
-     */
-    HttpResponse execute(RoutedRequest roureq, HttpContext context)
-        throws HttpException, IOException, InterruptedException
-        ;
-
 } // interface HttpClient

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java?rev=603977&r1=603976&r2=603977&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
Thu Dec 13 10:54:50 2007
@@ -49,7 +49,6 @@
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.HttpRequestRetryHandler;
 import org.apache.http.client.RedirectHandler;
-import org.apache.http.client.RoutedRequest;
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.conn.ClientConnectionManager;
 import org.apache.http.conn.HttpRoutePlanner;
@@ -457,32 +456,6 @@
     }
 
 
-    //@@@ to be removed with HTTPCLIENT-715
-    public final HttpResponse execute(RoutedRequest roureq,
-                                      HttpContext context)
-        throws HttpException, IOException, InterruptedException {
-        //throw new UnsupportedOperationException("@@@ execute(roureq,context)");
-
-        if (roureq == null) {
-            throw new IllegalArgumentException
-                ("Routed request must not be null.");
-        }
-        if (roureq.getRequest() == null) {
-            throw new IllegalArgumentException
-                ("Request must not be null.");
-        }
-        if (roureq.getRoute() == null) {
-            throw new IllegalArgumentException
-                ("Route must not be null.");
-        }
-
-        //@@@ this is a temporary violation of the API
-        //@@@ this method will be removed with HTTPCLIENT-715
-        return execute(roureq.getRoute().getTargetHost(),
-                       roureq.getRequest(), context);
-    }
-
-
     // non-javadoc, see interface HttpClient
     public final HttpResponse execute(HttpHost target, HttpRequest request)
         throws HttpException, IOException, InterruptedException {
@@ -543,7 +516,7 @@
      * and the client parameters.
      * <br/>
      * This method is called by the default implementation of
-     * {@link #execute(RoutedRequest,HttpContext)}
+     * {@link #execute(HttpHost,HttpRequest,HttpContext)}
      * to obtain the parameters for the
      * {@link DefaultClientRequestDirector}.
      *

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/protocol/TestCookie2Support.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/protocol/TestCookie2Support.java?rev=603977&r1=603976&r2=603977&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/protocol/TestCookie2Support.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/protocol/TestCookie2Support.java
Thu Dec 13 10:54:50 2007
@@ -41,7 +41,6 @@
 import org.apache.http.HttpStatus;
 import org.apache.http.ProtocolVersion;
 import org.apache.http.client.CookieStore;
-import org.apache.http.client.RoutedRequest;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.params.ClientPNames;
 import org.apache.http.client.params.CookiePolicy;
@@ -110,8 +109,7 @@
         
         HttpGet httpget = new HttpGet("/test/");
         
-        RoutedRequest request1 = new RoutedRequest.Impl(httpget, getDefaultRoute()); 
-        HttpResponse response1 = client.execute(request1, context);
+        HttpResponse response1 = client.execute(getServerHttp(), httpget, context);
         HttpEntity e1 = response1.getEntity();
         if (e1 != null) {
             e1.consumeContent();
@@ -121,8 +119,7 @@
         assertNotNull(cookies);
         assertEquals(1, cookies.length);
 
-        RoutedRequest request2 = new RoutedRequest.Impl(httpget, getDefaultRoute()); 
-        HttpResponse response2 = client.execute(request2, context);
+        HttpResponse response2 = client.execute(getServerHttp(), httpget, context);
         HttpEntity e2 = response2.getEntity();
         if (e2 != null) {
             e2.consumeContent();
@@ -163,8 +160,7 @@
         
         HttpGet httpget = new HttpGet("/test/");
         
-        RoutedRequest request1 = new RoutedRequest.Impl(httpget, getDefaultRoute()); 
-        HttpResponse response1 = client.execute(request1, context);
+        HttpResponse response1 = client.execute(getServerHttp(), httpget, context);
         HttpEntity e1 = response1.getEntity();
         if (e1 != null) {
             e1.consumeContent();
@@ -174,8 +170,7 @@
         assertNotNull(cookies);
         assertEquals(2, cookies.length);
 
-        RoutedRequest request2 = new RoutedRequest.Impl(httpget, getDefaultRoute()); 
-        HttpResponse response2 = client.execute(request2, context);
+        HttpResponse response2 = client.execute(getServerHttp(), httpget, context);
         HttpEntity e2 = response2.getEntity();
         if (e2 != null) {
             e2.consumeContent();
@@ -214,8 +209,7 @@
         
         HttpGet httpget = new HttpGet("/test/");
         
-        RoutedRequest request1 = new RoutedRequest.Impl(httpget, getDefaultRoute()); 
-        HttpResponse response1 = client.execute(request1, context);
+        HttpResponse response1 = client.execute(getServerHttp(), httpget, context);
         HttpEntity e1 = response1.getEntity();
         if (e1 != null) {
             e1.consumeContent();
@@ -225,8 +219,7 @@
         assertNotNull(cookies);
         assertEquals(1, cookies.length);
 
-        RoutedRequest request2 = new RoutedRequest.Impl(httpget, getDefaultRoute()); 
-        HttpResponse response2 = client.execute(request2, context);
+        HttpResponse response2 = client.execute(getServerHttp(), httpget, context);
         HttpEntity e2 = response2.getEntity();
         if (e2 != null) {
             e2.consumeContent();
@@ -267,8 +260,7 @@
         
         HttpGet httpget = new HttpGet("/test/");
         
-        RoutedRequest request1 = new RoutedRequest.Impl(httpget, getDefaultRoute()); 
-        HttpResponse response1 = client.execute(request1, context);
+        HttpResponse response1 = client.execute(getServerHttp(), httpget, context);
         HttpEntity e1 = response1.getEntity();
         if (e1 != null) {
             e1.consumeContent();

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestRequestWrapper.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestRequestWrapper.java?rev=603977&r1=603976&r2=603977&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestRequestWrapper.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/client/TestRequestWrapper.java
Thu Dec 13 10:54:50 2007
@@ -1,7 +1,7 @@
 /*
- * $HeadURL:$
- * $Revision:$
- * $Date:$
+ * $HeadURL$
+ * $Revision$
+ * $Date$
  * ====================================================================
  *
  *  Licensed to the Apache Software Foundation (ASF) under one or more
@@ -39,7 +39,6 @@
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpStatus;
-import org.apache.http.client.RoutedRequest;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.localserver.ServerTestBase;
@@ -50,7 +49,7 @@
 /**
  *  Simple tests for {@link RequestWrapper}.
  * 
- * @version $Revision:$
+ * @version $Revision$
  */
 public class TestRequestWrapper extends ServerTestBase {
 
@@ -97,8 +96,7 @@
         String s = "http://localhost:" + port + "/path";
         HttpGet httpget = new HttpGet(s);
 
-        RoutedRequest request = new RoutedRequest.Impl(httpget, getDefaultRoute()); 
-        HttpResponse response = client.execute(request, context);
+        HttpResponse response = client.execute(getServerHttp(), httpget, context);
         HttpEntity e = response.getEntity();
         if (e != null) {
             e.consumeContent();
@@ -123,8 +121,7 @@
         String s = "http://localhost:" + port;
         HttpGet httpget = new HttpGet(s);
 
-        RoutedRequest request = new RoutedRequest.Impl(httpget, getDefaultRoute()); 
-        HttpResponse response = client.execute(request, context);
+        HttpResponse response = client.execute(getServerHttp(), httpget, context);
         HttpEntity e = response.getEntity();
         if (e != null) {
             e.consumeContent();



Mime
View raw message