hc-commits mailing list archives

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

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

Modified:
    jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientExecuteDirect.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/HttpClient.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/protocol/TestRedirects.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/ServerTestBase.java

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientExecuteDirect.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientExecuteDirect.java?rev=603969&r1=603968&r2=603969&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientExecuteDirect.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/examples/org/apache/http/examples/client/ClientExecuteDirect.java
Thu Dec 13 10:30:18 2007
@@ -39,9 +39,7 @@
 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;
@@ -98,13 +96,10 @@
 
         HttpRequest req = createRequest();
 
-        final HttpRoute route = new HttpRoute(target, null, false);
-        final RoutedRequest roureq = new RoutedRequest.Impl(req, route);
-        
         System.out.println("executing request to " + target);
         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/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=603969&r1=603968&r2=603969&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:30:18 2007
@@ -219,5 +219,4 @@
         throws HttpException, IOException, InterruptedException
         ;
 
-
 } // interface HttpClient

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/protocol/TestRedirects.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/protocol/TestRedirects.java?rev=603969&r1=603968&r2=603969&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/protocol/TestRedirects.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/client/protocol/TestRedirects.java
Thu Dec 13 10:30:18 2007
@@ -45,7 +45,6 @@
 import org.apache.http.client.CircularRedirectException;
 import org.apache.http.client.CookieStore;
 import org.apache.http.client.RedirectException;
-import org.apache.http.client.RoutedRequest;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.params.ClientPNames;
@@ -244,8 +243,7 @@
 
         HttpGet httpget = new HttpGet("/oldlocation/");
 
-        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();
@@ -269,8 +267,7 @@
 
         HttpGet httpget = new HttpGet("/oldlocation/");
 
-        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();
@@ -298,8 +295,7 @@
 
         HttpGet httpget = new HttpGet("/oldlocation/");
 
-        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();
@@ -327,8 +323,7 @@
 
         HttpGet httpget = new HttpGet("/oldlocation/");
 
-        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();
@@ -356,8 +351,7 @@
 
         HttpGet httpget = new HttpGet("/oldlocation/");
 
-        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();
@@ -381,8 +375,7 @@
 
         HttpGet httpget = new HttpGet("/oldlocation/");
 
-        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();
@@ -406,8 +399,7 @@
 
         HttpGet httpget = new HttpGet("/oldlocation/");
 
-        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();
@@ -433,9 +425,8 @@
 
         HttpGet httpget = new HttpGet("/circular-oldlocation/");
 
-        RoutedRequest request = new RoutedRequest.Impl(httpget, getDefaultRoute());
         try {
-            client.execute(request, null);
+            client.execute(getServerHttp(), httpget);
             fail("RedirectException exception should have been thrown");
         } catch (RedirectException e) {
             // expected
@@ -450,9 +441,8 @@
 
         HttpGet httpget = new HttpGet("/circular-oldlocation/");
 
-        RoutedRequest request = new RoutedRequest.Impl(httpget, getDefaultRoute());
         try {
-            client.execute(request, null);
+            client.execute(getServerHttp(), httpget);
             fail("CircularRedirectException exception should have been thrown");
         } catch (CircularRedirectException e) {
             // expected
@@ -470,8 +460,7 @@
         HttpPost httppost = new HttpPost("/oldlocation/");
         httppost.setEntity(new StringEntity("stuff"));
 
-        RoutedRequest request = new RoutedRequest.Impl(httppost, getDefaultRoute()); 
-        HttpResponse response = client.execute(request, context);
+        HttpResponse response = client.execute(getServerHttp(), httppost, context);
         HttpEntity e = response.getEntity();
         if (e != null) {
             e.consumeContent();
@@ -497,8 +486,7 @@
                 ClientPNames.REJECT_RELATIVE_REDIRECT, false);
         HttpGet httpget = new HttpGet("/oldlocation/");
 
-        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();
@@ -527,8 +515,7 @@
                 ClientPNames.REJECT_RELATIVE_REDIRECT, false);
         HttpGet httpget = new HttpGet("/test/oldlocation");
 
-        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();
@@ -554,9 +541,8 @@
                 ClientPNames.REJECT_RELATIVE_REDIRECT, true);
         HttpGet httpget = new HttpGet("/oldlocation/");
 
-        RoutedRequest request = new RoutedRequest.Impl(httpget, getDefaultRoute());
         try {
-            client.execute(request, null);
+            client.execute(getServerHttp(), httpget);
             fail("ProtocolException exception should have been thrown");
         } catch (ProtocolException e) {
             // expected
@@ -570,9 +556,8 @@
 
         HttpGet httpget = new HttpGet("/oldlocation/");
 
-        RoutedRequest request = new RoutedRequest.Impl(httpget, getDefaultRoute());
         try {
-            client.execute(request, null);
+            client.execute(getServerHttp(), httpget);
             fail("IllegalStateException should have been thrown");
         } catch (IllegalStateException e) {
             // expected
@@ -589,9 +574,8 @@
 
         HttpGet httpget = new HttpGet("/oldlocation/");
 
-        RoutedRequest request = new RoutedRequest.Impl(httpget, getDefaultRoute());
         try {
-            client.execute(request, null);
+            client.execute(getServerHttp(), httpget);
             fail("ProtocolException should have been thrown");
         } catch (ProtocolException e) {
             // expected
@@ -619,9 +603,8 @@
         HttpContext context = client.getDefaultContext();
         HttpGet httpget = new HttpGet("/oldlocation/");
 
-        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();
@@ -654,9 +637,8 @@
         
         HttpGet httpget = new HttpGet("/oldlocation/");
 
-        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();

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/ServerTestBase.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/ServerTestBase.java?rev=603969&r1=603968&r2=603969&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/ServerTestBase.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/localserver/ServerTestBase.java
Thu Dec 13 10:30:18 2007
@@ -176,13 +176,14 @@
                             "http");
     }
 
+
     /**
      * Obtains the default route to the local test server.
      *
      * @return the default route to the local test server
      */
     protected HttpRoute getDefaultRoute() {
-        return new HttpRoute(new HttpHost("localhost", localServer.getServicePort())); 
+        return new HttpRoute(getServerHttp());
     }
     
 



Mime
View raw message