And now, added support for "If-None-Match" and "ETag" as well.

Spawned a new project at Github - http://github.com/gvaish/gae-utils

As before, any critics, feedback, inputs and bugs/issues are more than
welcome :)


-Gaurav
http://www.mastergaurav.com


On Oct 21, 5:09 pm, MasterGaurav <gaurav.va...@gmail.com> wrote:
> 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-htt...
>
> Removed the use of SimpleDateFormat and replaced it with DateUtil (as
> mentioned in the above post).
>
> -Gauravhttp://www.mastergaurav.com
>
> On Oct 21, 3:57 pm, Stephen <sdea...@gmail.com> wrote:
>
> > On Oct 21, 8:43 am, MasterGaurav <gaurav.va...@gmail.com> 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 google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to