Re: Servlet caching problem solved

> I've just moved a servlet from the JSDK/FastTrack to Jigsaw. I found that
> GET requests weren't always getting through to the servlet. I believe I've
> fixed the problem by having the servlet set the Last-Modified header
> explicitly.
> 
> As I understand it, I shouldn't need to do that. I was returning a
> sensible value from HttpServlet.getLastModified(), and the javax code
> automatically puts that into the header - provided the header hadn't
> already been set.
> 
> The difference between the JSDK/FastTrack combination and Jigsaw is that
> Jigsaw installs a default Last-Modified time before calling the servlet.
> This defeats the code in javax.servlet.http.HttpServlet. And the default
> value is the time I changed the servlet's configuration, which was days
> ago, so the browser thought the page hadn't changed.
> 
> I can see that setting Last-Modified explicitly is a good defensive thing
> to do, especially as the servlet API is vague about what really happens. I
> thought I'd mention it anyway, in case someone else has the same problem.
> 
> I wonder if Jigsaw should remove its Last-Modified value before calling
> the servlet, and put it back after the servlet has returned if the servlet
> hasn't set it itself? This would at least make the Jigsaw behaviour more
> consistent with the JSDK.
> 
>   Dave Harris, Nottingham, UK | "Weave a circle round him thrice,
>       brangdon@cix.co.uk      |   And close your eyes with holy dread,
>                               |  For he on honey dew hath fed
>  http://www.bhresearch.co.uk/ |   And drunk the milk of Paradise."
> 
 
  You are right, Jigsaw should remove its last-modified value in the
  reply header. But Jigsaw doesn't have to put back this value which doesn't
  make sense for the servlet. The servlet and only the servlet manage its
  last modified value.

  Here is the method to add in ServletWrapper (1.0beta) or in
  ServletWrapperFrame (2.0alpha):

  public Reply createDefaultReply(Request request, int status) {
    Reply reply = super.createDefaultReply(request, status);
    reply.setLastModified( -1 );
    return reply;
  }



- Benoît Mahé -------------------------------------------------------
                      World Wide Web Consortium (W3C)
                    Architecture domain - Jigsaw Team           

  http://www.w3.org/People/Mahe - bmahe@w3.org - +33.4.92.38.79.89 
---------------------------------------------------------------------

Received on Tuesday, 17 February 1998 08:51:44 UTC