From eb52607162edce644c5459739d20dbf64c5fe48a Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 15 Mar 2002 19:12:16 +0000 Subject: [PATCH] Adjust the last modified time of our cached files to match that of the server so that we properly report our last modified times when subsequently doing an If-Modified-Since request. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1125 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/resource/ResourceManager.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/resource/ResourceManager.java b/src/java/com/threerings/resource/ResourceManager.java index 78650816d..29d3e31d6 100644 --- a/src/java/com/threerings/resource/ResourceManager.java +++ b/src/java/com/threerings/resource/ResourceManager.java @@ -1,5 +1,5 @@ // -// $Id: ResourceManager.java,v 1.10 2002/03/15 02:18:18 mdb Exp $ +// $Id: ResourceManager.java,v 1.11 2002/03/15 19:12:16 mdb Exp $ package com.threerings.resource; @@ -310,6 +310,15 @@ public class ResourceManager } } + // if this is a URL request, we want to keep track of the + // last modified time + if (ucon instanceof HttpURLConnection) { + HttpURLConnection hucon = (HttpURLConnection)ucon; + lastModified = hucon.getLastModified(); + } else { + lastModified = 0; + } + // read the data from the URL into the cache file if (readData) { InputStream in = ucon.getInputStream(); @@ -318,6 +327,11 @@ public class ResourceManager StreamUtils.pipe(in, out); in.close(); out.close(); + // if we have a last modified time, we want to adjust + // our cache file accordingly + if (lastModified != 0) { + cfile.setLastModified(lastModified); + } } // finally add this newly cached file to the set as a