org.apache.http.client
Interface ClientRequestDirector

All Known Implementing Classes:
DefaultClientRequestDirector

public interface ClientRequestDirector

A client-side request director. The director decides which steps are necessary to execute a request. It establishes connections and optionally processes redirects and authentication challenges. The director may therefore generate and send a sequence of requests in order to execute one initial request.
Note: It is most likely that implementations of this interface will allocate connections, and return responses that depend on those connections for reading the response entity. Such connections MUST be released, but that is out of the scope of a request director. The getConnection provides access to the connection that must be released when the response is handled.

This interface and it's implementations replace the HttpMethodDirector in HttpClient 3.

Since:
4.0
Version:
$Revision: 578383 $
Author:
Roland Weber

Method Summary
 org.apache.http.HttpResponse execute(RoutedRequest roureq, org.apache.http.protocol.HttpContext context)
          Executes a request.
 ManagedClientConnection getConnection()
          Obtains the connection to which the response is tied.
 

Method Detail

execute

org.apache.http.HttpResponse execute(RoutedRequest roureq,
                                     org.apache.http.protocol.HttpContext context)
                                     throws org.apache.http.HttpException,
                                            java.io.IOException,
                                            java.lang.InterruptedException
Executes a request.
Note: For the time being, a new director is instantiated for each request. This is the same behavior as for HttpMethodDirector in HttpClient 3.

Parameters:
roureq - the route and request to execute
context - the context for executing the request
Returns:
the final response to the request. This is never an intermediate response with status code 1xx.
Throws:
org.apache.http.HttpException - in case of a problem
java.io.IOException - in case of an IO problem
java.lang.InterruptedException - in case of an interrupt

getConnection

ManagedClientConnection getConnection()
Obtains the connection to which the response is tied. Responses with a non-buffered response entity are tied to their connection until the entity is consumed or discarded. Until then, the connection must not be released. Afterwards, it must be released.

Returns:
the connection to which the response from execute is tied, or null if there is none


Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.