mobile/android/thirdparty/ch/boye/httpclientandroidlib/client/package.html

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     1 <html>
     2 <head>
     3 <!--
     4 /*
     5  * ====================================================================
     6  * Licensed to the Apache Software Foundation (ASF) under one
     7  * or more contributor license agreements.  See the NOTICE file
     8  * distributed with this work for additional information
     9  * regarding copyright ownership.  The ASF licenses this file
    10  * to you under the Apache License, Version 2.0 (the
    11  * "License"); you may not use this file except in compliance
    12  * with the License.  You may obtain a copy of the License at
    13  *
    14  *   http://www.apache.org/licenses/LICENSE-2.0
    15  *
    16  * Unless required by applicable law or agreed to in writing,
    17  * software distributed under the License is distributed on an
    18  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    19  * KIND, either express or implied.  See the License for the
    20  * specific language governing permissions and limitations
    21  * under the License.
    22  * ====================================================================
    23  *
    24  * This software consists of voluntary contributions made by many
    25  * individuals on behalf of the Apache Software Foundation.  For more
    26  * information on the Apache Software Foundation, please see
    27  * <http://www.apache.org/>.
    28  *
    29  */
    30 -->
    31 </head>
    32 <body>
    33 The API for client-side HTTP communication.
    34 <p/>
    35 The usual execution flow can be demonstrated by the
    36 code snippet below:
    38 <PRE>
    39 HttpClient httpclient = new DefaultHttpClient();
    41 // Prepare a request object
    42 HttpGet httpget = new HttpGet("http://www.apache.org/");
    44 // Execute the request
    45 HttpResponse response = httpclient.execute(httpget);
    47 // Examine the response status
    48 System.out.println(response.getStatusLine());
    50 // Get hold of the response entity
    51 HttpEntity entity = response.getEntity();
    53 // If the response does not enclose an entity, there is no need
    54 // to worry about connection release
    55 if (entity != null) {
    56     InputStream instream = entity.getContent();
    57     try {
    59         BufferedReader reader = new BufferedReader(
    60                 new InputStreamReader(instream));
    61         // do something useful with the response
    62         System.out.println(reader.readLine());
    64     } catch (IOException ex) {
    66         // In case of an IOException the connection will be released
    67         // back to the connection manager automatically
    68         throw ex;
    70     } catch (RuntimeException ex) {
    72         // In case of an unexpected exception you may want to abort
    73         // the HTTP request in order to shut down the underlying
    74         // connection and release it back to the connection manager.
    75         httpget.abort();
    76         throw ex;
    78     } finally {
    80         // Closing the input stream will trigger connection release
    81         instream.close();
    83     }
    84 }
    86 </PRE>
    88 </body>
    89 </html>

mercurial