1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/thirdparty/ch/boye/httpclientandroidlib/HttpClientConnection.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,102 @@ 1.4 +/* 1.5 + * ==================================================================== 1.6 + * Licensed to the Apache Software Foundation (ASF) under one 1.7 + * or more contributor license agreements. See the NOTICE file 1.8 + * distributed with this work for additional information 1.9 + * regarding copyright ownership. The ASF licenses this file 1.10 + * to you under the Apache License, Version 2.0 (the 1.11 + * "License"); you may not use this file except in compliance 1.12 + * with the License. You may obtain a copy of the License at 1.13 + * 1.14 + * http://www.apache.org/licenses/LICENSE-2.0 1.15 + * 1.16 + * Unless required by applicable law or agreed to in writing, 1.17 + * software distributed under the License is distributed on an 1.18 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1.19 + * KIND, either express or implied. See the License for the 1.20 + * specific language governing permissions and limitations 1.21 + * under the License. 1.22 + * ==================================================================== 1.23 + * 1.24 + * This software consists of voluntary contributions made by many 1.25 + * individuals on behalf of the Apache Software Foundation. For more 1.26 + * information on the Apache Software Foundation, please see 1.27 + * <http://www.apache.org/>. 1.28 + * 1.29 + */ 1.30 + 1.31 +package ch.boye.httpclientandroidlib; 1.32 + 1.33 +import java.io.IOException; 1.34 + 1.35 +/** 1.36 + * A client-side HTTP connection, which can be used for sending 1.37 + * requests and receiving responses. 1.38 + * 1.39 + * @since 4.0 1.40 + */ 1.41 +public interface HttpClientConnection extends HttpConnection { 1.42 + 1.43 + /** 1.44 + * Checks if response data is available from the connection. May wait for 1.45 + * the specified time until some data becomes available. Note that some 1.46 + * implementations may completely ignore the timeout parameter. 1.47 + * 1.48 + * @param timeout the maximum time in milliseconds to wait for data 1.49 + * @return true if data is available; false if there was no data available 1.50 + * even after waiting for <code>timeout</code> milliseconds. 1.51 + * @throws IOException if an error happens on the connection 1.52 + */ 1.53 + boolean isResponseAvailable(int timeout) 1.54 + throws IOException; 1.55 + 1.56 + /** 1.57 + * Sends the request line and all headers over the connection. 1.58 + * @param request the request whose headers to send. 1.59 + * @throws HttpException in case of HTTP protocol violation 1.60 + * @throws IOException in case of an I/O error 1.61 + */ 1.62 + void sendRequestHeader(HttpRequest request) 1.63 + throws HttpException, IOException; 1.64 + 1.65 + /** 1.66 + * Sends the request entity over the connection. 1.67 + * @param request the request whose entity to send. 1.68 + * @throws HttpException in case of HTTP protocol violation 1.69 + * @throws IOException in case of an I/O error 1.70 + */ 1.71 + void sendRequestEntity(HttpEntityEnclosingRequest request) 1.72 + throws HttpException, IOException; 1.73 + 1.74 + /** 1.75 + * Receives the request line and headers of the next response available from 1.76 + * this connection. The caller should examine the HttpResponse object to 1.77 + * find out if it should try to receive a response entity as well. 1.78 + * 1.79 + * @return a new HttpResponse object with status line and headers 1.80 + * initialized. 1.81 + * @throws HttpException in case of HTTP protocol violation 1.82 + * @throws IOException in case of an I/O error 1.83 + */ 1.84 + HttpResponse receiveResponseHeader() 1.85 + throws HttpException, IOException; 1.86 + 1.87 + /** 1.88 + * Receives the next response entity available from this connection and 1.89 + * attaches it to an existing HttpResponse object. 1.90 + * 1.91 + * @param response the response to attach the entity to 1.92 + * @throws HttpException in case of HTTP protocol violation 1.93 + * @throws IOException in case of an I/O error 1.94 + */ 1.95 + void receiveResponseEntity(HttpResponse response) 1.96 + throws HttpException, IOException; 1.97 + 1.98 + /** 1.99 + * Writes out all pending buffered data over the open connection. 1.100 + * 1.101 + * @throws IOException in case of an I/O error 1.102 + */ 1.103 + void flush() throws IOException; 1.104 + 1.105 +}