1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/sync/net/BaseResourceDelegate.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,44 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +package org.mozilla.gecko.sync.net; 1.9 + 1.10 +import ch.boye.httpclientandroidlib.client.methods.HttpRequestBase; 1.11 +import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient; 1.12 + 1.13 +/** 1.14 + * Shared abstract class for resource delegate that use the same timeouts 1.15 + * and no credentials. 1.16 + * 1.17 + * @author rnewman 1.18 + * 1.19 + */ 1.20 +public abstract class BaseResourceDelegate implements ResourceDelegate { 1.21 + public static int connectionTimeoutInMillis = 1000 * 30; // Wait 30s for a connection to open. 1.22 + public static int socketTimeoutInMillis = 1000 * 2 * 60; // Wait 2 minutes for data. 1.23 + 1.24 + protected Resource resource; 1.25 + public BaseResourceDelegate(Resource resource) { 1.26 + this.resource = resource; 1.27 + } 1.28 + 1.29 + @Override 1.30 + public int connectionTimeout() { 1.31 + return connectionTimeoutInMillis; 1.32 + } 1.33 + 1.34 + @Override 1.35 + public int socketTimeout() { 1.36 + return socketTimeoutInMillis; 1.37 + } 1.38 + 1.39 + @Override 1.40 + public AuthHeaderProvider getAuthHeaderProvider() { 1.41 + return null; 1.42 + } 1.43 + 1.44 + @Override 1.45 + public void addHeaders(HttpRequestBase request, DefaultHttpClient client) { 1.46 + } 1.47 +}