Home | History | Annotate | Download | only in client
      1 /*
      2  * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/client/RequestDirector.java $
      3  * $Revision: 676020 $
      4  * $Date: 2008-07-11 09:38:49 -0700 (Fri, 11 Jul 2008) $
      5  *
      6  * ====================================================================
      7  * Licensed to the Apache Software Foundation (ASF) under one
      8  * or more contributor license agreements.  See the NOTICE file
      9  * distributed with this work for additional information
     10  * regarding copyright ownership.  The ASF licenses this file
     11  * to you under the Apache License, Version 2.0 (the
     12  * "License"); you may not use this file except in compliance
     13  * with the License.  You may obtain a copy of the License at
     14  *
     15  *   http://www.apache.org/licenses/LICENSE-2.0
     16  *
     17  * Unless required by applicable law or agreed to in writing,
     18  * software distributed under the License is distributed on an
     19  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     20  * KIND, either express or implied.  See the License for the
     21  * specific language governing permissions and limitations
     22  * under the License.
     23  * ====================================================================
     24  *
     25  * This software consists of voluntary contributions made by many
     26  * individuals on behalf of the Apache Software Foundation.  For more
     27  * information on the Apache Software Foundation, please see
     28  * <http://www.apache.org/>.
     29  *
     30  */
     31 
     32 package org.apache.http.client;
     33 
     34 import java.io.IOException;
     35 
     36 import org.apache.http.HttpHost;
     37 import org.apache.http.HttpRequest;
     38 import org.apache.http.HttpResponse;
     39 import org.apache.http.HttpException;
     40 import org.apache.http.protocol.HttpContext;
     41 
     42 /**
     43  * A client-side request director.
     44  * The director decides which steps are necessary to execute a request.
     45  * It establishes connections and optionally processes redirects and
     46  * authentication challenges. The director may therefore generate and
     47  * send a sequence of requests in order to execute one initial request.
     48  *
     49  * <br/><b>Note:</b>
     50  * It is most likely that implementations of this interface will
     51  * allocate connections, and return responses that depend on those
     52  * connections for reading the response entity. Such connections
     53  * MUST be released, but that is out of the scope of a request director.
     54  *
     55  * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
     56  *
     57  *
     58  * <!-- empty lines to avoid svn diff problems -->
     59  * @version $Revision: 676020 $
     60  *
     61  * @since 4.0
     62  *
     63  * @deprecated Please use {@link java.net.URL#openConnection} instead.
     64  *     Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a>
     65  *     for further details.
     66  */
     67 @Deprecated
     68 public interface RequestDirector {
     69 
     70 
     71     /**
     72      * Executes a request.
     73      * <br/><b>Note:</b>
     74      * For the time being, a new director is instantiated for each request.
     75      * This is the same behavior as for <code>HttpMethodDirector</code>
     76      * in HttpClient 3.
     77      *
     78      * @param target    the target host for the request.
     79      *                  Implementations may accept <code>null</code>
     80      *                  if they can still determine a route, for example
     81      *                  to a default target or by inspecting the request.
     82      * @param request   the request to execute
     83      * @param context   the context for executing the request
     84      *
     85      * @return  the final response to the request.
     86      *          This is never an intermediate response with status code 1xx.
     87      *
     88      * @throws HttpException            in case of a problem
     89      * @throws IOException              in case of an IO problem
     90      *                                     or if the connection was aborted
     91      */
     92     HttpResponse execute(HttpHost target, HttpRequest request,
     93                          HttpContext context)
     94         throws HttpException, IOException
     95         ;
     96 
     97 } // class ClientRequestDirector
     98