aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/network/Network.java
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/network/Network.java')
-rw-r--r--main/src/cgeo/geocaching/network/Network.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/network/Network.java b/main/src/cgeo/geocaching/network/Network.java
index 57196c5..2d2ab0b 100644
--- a/main/src/cgeo/geocaching/network/Network.java
+++ b/main/src/cgeo/geocaching/network/Network.java
@@ -1,9 +1,9 @@
package cgeo.geocaching.network;
-import cgeo.geocaching.Settings;
import cgeo.geocaching.files.LocalStorage;
-import cgeo.geocaching.utils.TextUtils;
+import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.utils.Log;
+import cgeo.geocaching.utils.TextUtils;
import ch.boye.httpclientandroidlib.Header;
import ch.boye.httpclientandroidlib.HeaderElement;
@@ -317,12 +317,14 @@ public abstract class Network {
return null;
}
- final String etag = LocalStorage.getSavedHeader(cacheFile, "etag");
+ final String etag = LocalStorage.getSavedHeader(cacheFile, LocalStorage.HEADER_ETAG);
if (etag != null) {
+ // The ETag is a more robust check than a timestamp. If we have an ETag, it is enough
+ // to identify the right version of the resource.
return new Parameters("If-None-Match", etag);
}
- final String lastModified = LocalStorage.getSavedHeader(cacheFile, "last-modified");
+ final String lastModified = LocalStorage.getSavedHeader(cacheFile, LocalStorage.HEADER_LAST_MODIFIED);
if (lastModified != null) {
return new Parameters("If-Modified-Since", lastModified);
}
@@ -476,10 +478,10 @@ public abstract class Network {
/**
* Checks if the device has network connection.
- *
+ *
* @param context
* context of the application, cannot be null
- *
+ *
* @return <code>true</code> if the device is connected to the network.
*/
public static boolean isNetworkConnected(Context context) {