HTTPCLIENT-715: one of the RoutedRequest methods removed from HttpClient interface

git-svn-id: https://svn.apache.org/repos/asf/jakarta/httpcomponents/httpclient/trunk@603966 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Roland Weber 2007-12-13 18:15:11 +00:00
parent 6d57a9d5a8
commit 92a3847e4c
3 changed files with 78 additions and 30 deletions

View File

@ -33,6 +33,8 @@ package org.apache.http.client;
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;
@ -134,6 +136,66 @@ public interface HttpClient {
;
/**
* Executes a request to the target using the
* {@link #getDefaultContext() default context}.
* See there for details.
*
* @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)
throws HttpException, IOException, InterruptedException
;
/**
* 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.
*
@ -146,6 +208,8 @@ public interface HttpClient {
* {@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
@ -155,23 +219,5 @@ public interface HttpClient {
throws HttpException, IOException, InterruptedException
;
/**
* Executes a request along the given route using the
* {@link #getDefaultContext() default context}.
* @param roureq the request to execute along with the route
*
* @return the response to the request. See
* {@link #execute(HttpUriRequest,HttpContext)}
* for details.
*
* @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)
throws HttpException, IOException, InterruptedException
;
} // interface HttpClient

View File

@ -456,17 +456,12 @@ public abstract class AbstractHttpClient implements HttpClient {
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 @@ public abstract class AbstractHttpClient implements HttpClient {
// 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 {

View File

@ -435,7 +435,7 @@ public class TestRedirects extends ServerTestBase {
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 @@ public class TestRedirects extends ServerTestBase {
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 @@ public class TestRedirects extends ServerTestBase {
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 @@ public class TestRedirects extends ServerTestBase {
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 @@ public class TestRedirects extends ServerTestBase {
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