You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ro...@apache.org on 2007/12/13 19:15:13 UTC

svn commit: r603966 - in /jakarta/httpcomponents/httpclient/trunk/module-client/src: main/java/org/apache/http/client/ main/java/org/apache/http/impl/client/ test/java/org/apache/http/client/protocol/

Author: rolandw
Date: Thu Dec 13 10:15:11 2007
New Revision: 603966

URL: http://svn.apache.org/viewvc?rev=603966&view=rev
Log:
HTTPCLIENT-715: one of the RoutedRequest methods removed from HttpClient interface

Modified:
    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/TestRedirects.java

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=603966&r1=603965&r2=603966&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:15:11 2007
@@ -33,6 +33,8 @@
 
 import java.io.IOException;
 
+import org.apache.http.HttpHost;
+import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.HttpException;
 import org.apache.http.params.HttpParams;
@@ -135,43 +137,87 @@
 
 
     /**
-     * Executes a request along the given route.
+     * Executes a request to the target using the
+     * {@link #getDefaultContext() default context}.
+     * See there for details.
      *
-     * @param roureq    the request to execute along with the route
+     * @param target    the target host for the request.
+     *                  Implementations may accept <code>null</code>
+     *                  if they can still determine a route, for example
+     *                  to a default target or by inspecting the request.
+     * @param request   the request to execute
      * @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.
+     * @return  the response to the request. This is always a final response,
+     *          never an intermediate response with an 1xx status code.
+     *          Whether redirects or authentication challenges will be returned
+     *          or handled automatically depends on the implementation and
+     *          configuration of this client.
      *
      * @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)
+    HttpResponse execute(HttpHost target, HttpRequest request)
         throws HttpException, IOException, InterruptedException
         ;
 
+
     /**
-     * Executes a request along the given route using the 
-     * {@link #getDefaultContext() default context}.
+     * Executes a request to the target with the given context.
+     *
+     * @param target    the target host for the request.
+     *                  Implementations may accept <code>null</code>
+     *                  if they can still determine a route, for example
+     *                  to a default target or by inspecting the request.
+     * @param request   the request to execute
+     * @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. This is always a final response,
+     *          never an intermediate response with an 1xx status code.
+     *          Whether redirects or authentication challenges will be returned
+     *          or handled automatically depends on the implementation and
+     *          configuration of this client.
+     *
+     * @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(HttpHost target, HttpRequest request,
+                         HttpContext context)
+        throws HttpException, IOException, InterruptedException
+        ;
 
+
+
+    /**
+     * 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)
+    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=603966&r1=603965&r2=603966&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:15:11 2007
@@ -456,17 +456,12 @@
         return execute(target, request, context);
     }
 
-    //@@@ to be removed with HTTPCLIENT-715
-    public HttpResponse execute(RoutedRequest roureq) 
-        throws HttpException, IOException, InterruptedException {
-        return execute(roureq, null);
-    }
-
 
     //@@@ 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
@@ -489,7 +484,14 @@
 
 
     // non-javadoc, see interface HttpClient
-    //@@@ currently not in interface, will be changed with HTTPCLIENT-715
+    public final HttpResponse execute(HttpHost target, HttpRequest request)
+        throws HttpException, IOException, InterruptedException {
+
+        return execute(target, request, null);
+    }
+
+
+    // non-javadoc, see interface HttpClient
     public final HttpResponse execute(HttpHost target, HttpRequest request,
                                       HttpContext context)
         throws HttpException, IOException, InterruptedException {

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=603966&r1=603965&r2=603966&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:15:11 2007
@@ -435,7 +435,7 @@
 
         RoutedRequest request = new RoutedRequest.Impl(httpget, getDefaultRoute());
         try {
-            client.execute(request);
+            client.execute(request, null);
             fail("RedirectException exception should have been thrown");
         } catch (RedirectException e) {
             // expected
@@ -452,7 +452,7 @@
 
         RoutedRequest request = new RoutedRequest.Impl(httpget, getDefaultRoute());
         try {
-            client.execute(request);
+            client.execute(request, null);
             fail("CircularRedirectException exception should have been thrown");
         } catch (CircularRedirectException e) {
             // expected
@@ -556,7 +556,7 @@
 
         RoutedRequest request = new RoutedRequest.Impl(httpget, getDefaultRoute());
         try {
-            client.execute(request);
+            client.execute(request, null);
             fail("ProtocolException exception should have been thrown");
         } catch (ProtocolException e) {
             // expected
@@ -572,7 +572,7 @@
 
         RoutedRequest request = new RoutedRequest.Impl(httpget, getDefaultRoute());
         try {
-            client.execute(request);
+            client.execute(request, null);
             fail("IllegalStateException should have been thrown");
         } catch (IllegalStateException e) {
             // expected
@@ -591,7 +591,7 @@
 
         RoutedRequest request = new RoutedRequest.Impl(httpget, getDefaultRoute());
         try {
-            client.execute(request);
+            client.execute(request, null);
             fail("ProtocolException should have been thrown");
         } catch (ProtocolException e) {
             // expected