tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony LaPaso" <tlap...@attbi.com>
Subject Re: ??? Using JSPs to Send Not-Modified-Since Header ???
Date Tue, 04 Jun 2002 21:54:05 GMT
Yes, but I'd prefer not to muck w/HttpJspBase -- as you said, it
is Tomcat specific.

I was hoping ther would be a more "portable", "approved"
way...but it looks like the JSP spec does not yet support it.
Really too bad -- getLastModified() was a big win.


----- Original Message -----
From: "Carlos Ferreira" <carlos.ferreira@gilem.com>
To: <tomcat-user@jakarta.apache.org>
Cc: <tlapaso@attbi.com>; <servlet-interest@java.sun.com>;
<jsp-interest@java.sun.com>
Sent: Tuesday, June 04, 2002 10:33 AM
Subject: Re: ??? Using JSPs to Send Not-Modified-Since Header ???


>
> a not so good solution would be to subclass
> org.apache.jasper.runtime.HttpJspBase ( or redesign it ) with
your
> required behaviour and extend your jsp pages from this new
class.
> the problem is that HttpJspBase is tomcat specific. perhaps
somebody has a
> better idea.
>
> Carlos Ferreira
> Gilem Informatique
>
> > Hi all,
> >
> > In looking at past posts, I'm afraid I know the horrible
answer
> > to this issue but I thought I'd ask just in case I missed
> > anything.
> >
> > Let me start by saying I'm using Tomcat v4.0.4 beta 3.
> >
> > As you know, when a client (usually a web browser) has a
cached
> > version of a resource (usually a web page) it can send an
> > "If-Modified-Since" header to the HTTP server. The server
> > compares the time/date stamp specified in the header with
that of
> > the requested resource. If the resource has *not* been
modified
> > since the time specified in the "If-Modified-Since" header,
the
> > server sends back a 304 (Not-Modified) response, effectively
> > telling the client (usually a web browser) that its cached
> > version of the resource is still valid.
> >
> > When writing a servlet, it's easy to handle this sort of
> > scenario. The javax.servlet.http.HttpServlet class has a
> > "service()" method. This method first checks if the incoming
HTTP
> > method is a GET. If it is, the "service()" method proceeds to
> > call the "getLastModified()" method of the servlet. As a
> > developer, you can override "getLastModified()" to return a
long
> > value representing the last time the requested resource was
> > changed. Depending on the value returned by
"getLastModified()"
> > (note that -1 is returned if you don't override the method)
the
> > "service()" method may simply return a 304, Not-Modified
response
> > rather than calling the servlet's "doGet()" method.
> >
> > Now, the $18.32 Question: How do you ensure
"getLastModified()"
> > is called in JSP?
> >
> > No, you cannot simply do this:
> >
> > <%!
> >   public long getLastModified() {
> >      return xxx;
> >   }
> > %>
> >
> > The problem is that the above method will never be called by
the
> > container.
> >
> > I traced through some of the Tomcat/Catalina/Jasper code and
it
> > seems to me that the response code is being set to 200/OK
very
> > early on in the processing.
> >
> > I also took a cursory look at the JSP spec and didn't find
any
> > indication of setting a "Not-Modified" response code...so, I
am
> > thinking this is something that is (strangely) missing in the
JSP
> > specification. I have a JSP page that needs to update itself
once
> > per day. Therefore, it would be very handy to have the
> > "getLastModified()" functionality enjoyed by servlet writers.
> >
> > Can anyone confirm this?
> >
> > Thanks...
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:tomcat-user-unsubscribe@jakarta.apache.org> For
additional
> > commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>
>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message