michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.sync.net; michael@0: michael@0: import ch.boye.httpclientandroidlib.client.methods.HttpRequestBase; michael@0: import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient; michael@0: michael@0: /** michael@0: * Shared abstract class for resource delegate that use the same timeouts michael@0: * and no credentials. michael@0: * michael@0: * @author rnewman michael@0: * michael@0: */ michael@0: public abstract class BaseResourceDelegate implements ResourceDelegate { michael@0: public static int connectionTimeoutInMillis = 1000 * 30; // Wait 30s for a connection to open. michael@0: public static int socketTimeoutInMillis = 1000 * 2 * 60; // Wait 2 minutes for data. michael@0: michael@0: protected Resource resource; michael@0: public BaseResourceDelegate(Resource resource) { michael@0: this.resource = resource; michael@0: } michael@0: michael@0: @Override michael@0: public int connectionTimeout() { michael@0: return connectionTimeoutInMillis; michael@0: } michael@0: michael@0: @Override michael@0: public int socketTimeout() { michael@0: return socketTimeoutInMillis; michael@0: } michael@0: michael@0: @Override michael@0: public AuthHeaderProvider getAuthHeaderProvider() { michael@0: return null; michael@0: } michael@0: michael@0: @Override michael@0: public void addHeaders(HttpRequestBase request, DefaultHttpClient client) { michael@0: } michael@0: }