1 /*
2  * $HeadURL: http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/module-main/src/main/java/org/apache/http/HttpClientConnection.java $
3  * $Revision: 542199 $
4  * $Date: 2007-05-28 04:23:46 -0700 (Mon, 28 May 2007) $
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;
33 
34 import java.io.IOException;
35 
36 /**
37  * An HTTP connection for use on the client side.
38  * It is used for sending requests and receiving responses.
39  *
40  * @author <a href="mailto:oleg at ural.ru">Oleg Kalnichevski</a>
41  *
42  *
43  * <!-- empty lines above to avoid 'svn diff' context problems -->
44  * @version $Revision: 542199 $
45  *
46  * @since 4.0
47  *
48  * @deprecated Please use {@link java.net.URL#openConnection} instead.
49  *     Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a>
50  *     for further details.
51  */
52 @Deprecated
53 public interface HttpClientConnection extends HttpConnection {
54 
55     /**
56      * Checks if response data is available from the connection. May wait for
57      * the specified time until some data becomes available. Note that some
58      * implementations may completely ignore the timeout parameter.
59      *
60      * @param timeout the maximum time in milliseconds to wait for data
61      * @return true if data is available; false if there was no data available
62      *         even after waiting for <code>timeout</code> milliseconds.
63      * @throws IOException if an error happens on the connection
64      */
isResponseAvailable(int timeout)65     boolean isResponseAvailable(int timeout)
66         throws IOException;
67 
68     /**
69      * Sends the request line and all headers over the connection.
70      * @param request the request whose headers to send.
71      * @throws HttpException
72      * @throws IOException
73      */
sendRequestHeader(HttpRequest request)74     void sendRequestHeader(HttpRequest request)
75         throws HttpException, IOException;
76 
77     /**
78      * Sends the request entity over the connection.
79      * @param request the request whose entity to send.
80      * @throws HttpException
81      * @throws IOException
82      */
sendRequestEntity(HttpEntityEnclosingRequest request)83     void sendRequestEntity(HttpEntityEnclosingRequest request)
84         throws HttpException, IOException;
85 
86     /**
87      * Receives the request line and headers of the next response available from
88      * this connection. The caller should examine the HttpResponse object to
89      * find out if it should try to receive a response entity as well.
90      *
91      * @return a new HttpResponse object with status line and headers
92      *         initialized.
93      * @throws HttpException
94      * @throws IOException
95      */
receiveResponseHeader()96     HttpResponse receiveResponseHeader()
97         throws HttpException, IOException;
98 
99     /**
100      * Receives the next response entity available from this connection and
101      * attaches it to an existing HttpResponse object.
102      *
103      * @param response the response to attach the entity to
104      * @throws HttpException
105      * @throws IOException
106      */
receiveResponseEntity(HttpResponse response)107     void receiveResponseEntity(HttpResponse response)
108         throws HttpException, IOException;
109 
110     /**
111      * Writes out all pending buffered data over the open connection.
112      *
113      * @throws IOException
114      */
flush()115     void flush() throws IOException;
116 
117 }
118