|
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/. */ |
|
4 |
|
5 package org.mozilla.gecko.sync.net; |
|
6 |
|
7 import ch.boye.httpclientandroidlib.client.methods.HttpRequestBase; |
|
8 import ch.boye.httpclientandroidlib.impl.client.DefaultHttpClient; |
|
9 |
|
10 /** |
|
11 * Shared abstract class for resource delegate that use the same timeouts |
|
12 * and no credentials. |
|
13 * |
|
14 * @author rnewman |
|
15 * |
|
16 */ |
|
17 public abstract class BaseResourceDelegate implements ResourceDelegate { |
|
18 public static int connectionTimeoutInMillis = 1000 * 30; // Wait 30s for a connection to open. |
|
19 public static int socketTimeoutInMillis = 1000 * 2 * 60; // Wait 2 minutes for data. |
|
20 |
|
21 protected Resource resource; |
|
22 public BaseResourceDelegate(Resource resource) { |
|
23 this.resource = resource; |
|
24 } |
|
25 |
|
26 @Override |
|
27 public int connectionTimeout() { |
|
28 return connectionTimeoutInMillis; |
|
29 } |
|
30 |
|
31 @Override |
|
32 public int socketTimeout() { |
|
33 return socketTimeoutInMillis; |
|
34 } |
|
35 |
|
36 @Override |
|
37 public AuthHeaderProvider getAuthHeaderProvider() { |
|
38 return null; |
|
39 } |
|
40 |
|
41 @Override |
|
42 public void addHeaders(HttpRequestBase request, DefaultHttpClient client) { |
|
43 } |
|
44 } |