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