Hi Stephen,
Great catch!
Here's the updated code:
-----------------------------------------------------------
if(req.getHeader("If-Modified-Since") != null)
{
long entryTime = entry.getTime();
String rawDate = req.getHeader("If-Modified-Since");
Date headerDate;
try
{
headerDate = DateUtil.parseDate(rawDate);
long headerTime = headerDate.getTime();
if(headerTime >= entryTime)
{
resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
return;
}
} catch(DateParseException e)
{
e.printStackTrace();
}
}
-----------------------------------------------------------
Doing an update to the server now...
http://stackoverflow.com/questions/1930158/how-to-parse-date-from-http-last-modified-header
Removed the use of SimpleDateFormat and replaced it with DateUtil (as
mentioned in the above post).
-Gaurav
http://www.mastergaurav.com
On Oct 21, 3:57 pm, Stephen <[email protected]> wrote:
> On Oct 21, 8:43 am, MasterGaurav <[email protected]> wrote:
>
> > Hi,
>
> > I have put up an updated Unzippper servlet to serve static files
> > (actually based
> > onhttp://code.google.com/p/googleappengine/issues/detail?id=161#c68)...
> > just in case you are looking for a solution.
>
> >http://code.google.com/p/googleappengine/issues/detail?id=161#c88
>
> > My addendum:
> > - Respond with a 304 in case of "If-Modified-Since".
>
> I don't think this will work:
>
> if(req.getHeader("If-Modified-Since") != null)
> {
> resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
> return;
> }
>
> If the contents of the zipfile are updated, and the client sends an if-
> modified-since header, you will respond with a 304 not modified
> response and the client will show stale content.
>
> You need to parse the data supplied with the if-modified-since header
> and compare it to the last modified time of the file within the
> zipfile, or at least to the zipfile as a whole.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.