You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Sunny L.S.Chan" <su...@delirium.com.hk> on 2000/11/07 08:50:24 UTC

Tomcat Caching problem

Hi all, does anynoe encountered this problem, where by tomcat 3.1 standalone
kept displaying a cached copy of the servlet file instead of loading the
servlet everytime it is executed?

Apparently it won't grab the form values in my doGet, and also everytime I
recompile the servlet,  on re-load it gives me the previous copy at which I
have to restart tomcat to get the latest copy.

I have included all these stuff below in my servlet:

  res.setHeader("Cache-Control","no-cache");
  res.setHeader("Pragma","no-cache");
  res.setDateHeader ("Expires", 0); //prevents caching at the proxy server

I suppose these settings tell the browser not to cache that page, also in my
server.xml file I have set the reloadable="true" in the context path
setting, but apparently tomcat still caches the page

Any help is appreciated :)

Thankx


Re: Tomcat Caching problem

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
"Sunny L.S.Chan" wrote:

> Hi all, does anynoe encountered this problem, where by tomcat 3.1 standalone
> kept displaying a cached copy of the servlet file instead of loading the
> servlet everytime it is executed?
>
> Apparently it won't grab the form values in my doGet, and also everytime I
> recompile the servlet,  on re-load it gives me the previous copy at which I
> have to restart tomcat to get the latest copy.
>
> I have included all these stuff below in my servlet:
>
>   res.setHeader("Cache-Control","no-cache");
>   res.setHeader("Pragma","no-cache");
>   res.setDateHeader ("Expires", 0); //prevents caching at the proxy server
>
> I suppose these settings tell the browser not to cache that page, also in my
> server.xml file I have set the reloadable="true" in the context path
> setting, but apparently tomcat still caches the page
>
> Any help is appreciated :)
>

It's not going to be much comfort to you, but ... Tomcat 3.1 caches *no* static
pages on it's own.

If you modify a servlet, you will need to ensure that Tomcat is restarted before
the changes will be visible.  This can be done by manually shutting it down and
restarting it, or by marking this webapp as "reloadable" in the server.xml file.

WARNING:  Even if you make your webapp reloadable, Tomcat can only pick up
changes to servlets that are in the WEB-INF/classes or WEB-INF/lib directories
of your webapp.  If the classes are on the CLASSPATH, your only option is to
manually restart.

>
> Thankx

Craig McClanahan