mobile/android/base/sync/net/ResourceDelegate.java

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 package org.mozilla.gecko.sync.net;
     7 import java.io.IOException;
     8 import java.security.GeneralSecurityException;
    10 import ch.boye.httpclientandroidlib.HttpResponse;
    11 import ch.boye.httpclientandroidlib.client.ClientProtocolException;
    12 import ch.boye.httpclientandroidlib.client.methods.HttpRequestBase;
    13 import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient;
    15 /**
    16  * ResourceDelegate implementers must ensure that HTTP responses
    17  * are fully consumed to ensure that connections are returned to
    18  * the pool:
    19  *
    20  *          EntityUtils.consume(entity);
    21  * @author rnewman
    22  *
    23  */
    24 public interface ResourceDelegate {
    25   // Request augmentation.
    26   AuthHeaderProvider getAuthHeaderProvider();
    27   void addHeaders(HttpRequestBase request, DefaultHttpClient client);
    29   /**
    30    * The value of the User-Agent header to include with the request.
    31    *
    32    * @return User-Agent header value; null means do not set User-Agent header.
    33    */
    34   public String getUserAgent();
    36   // Response handling.
    38   /**
    39    * Override this to handle an HttpResponse.
    40    *
    41    * ResourceDelegate implementers <b>must</b> ensure that HTTP responses are
    42    * fully consumed to ensure that connections are returned to the pool, for
    43    * example by calling <code>EntityUtils.consume(response.getEntity())</code>.
    44    */
    45   void handleHttpResponse(HttpResponse response);
    46   void handleHttpProtocolException(ClientProtocolException e);
    47   void handleHttpIOException(IOException e);
    49   // During preparation.
    50   void handleTransportException(GeneralSecurityException e);
    52   // Connection parameters.
    53   int connectionTimeout();
    54   int socketTimeout();
    55 }

mercurial