1

Hi i need to disable tomcat caching for a single page. i have gone through the ref,

Control server side caching by page (Tomcat)? & Java servlet how to disable caching of page

here the solution is i need to do this::

// Set standard HTTP/1.1 no-cache headers. response.setHeader("Cache-Control", "private, no-store, no-cache, must-revalidate");

// Set standard HTTP/1.0 no-cache header. response.setHeader("Pragma", "no-cache");

But i dont have any servlet class for that particular page. And the above code snipet i need to add to a servlet class i guess..Am i correct?? Is there any way to disable tomcate caching for a single page from a normal java file,,,??

Some more info about my technology and framework::

We have a framework called tapestry(3). We have a servlet class called ApplicationServlet. That combines a .jwc file(that contains nonstatic part) and html together to create a new html page. :)

Community
  • 1
  • 1
koushik
  • 55
  • 7
  • What do you mean by "normal java file"? A JSP? If so, you might want to edit your question and tags. I'm not good at guessing. – f_puras Aug 30 '12 at 10:57
  • No we dont have a jsp file.. We have a framework called tapestry. We have a servlet class called ApplicationServlet. That combines a .jwc file(that contains nonstatic part) and html together to create a new html page. :) – koushik Aug 30 '12 at 11:10
  • Fine. You should mention this (IMHO essential) information in your question - and it will attract the respective experts. – f_puras Aug 30 '12 at 11:14

1 Answers1

0

You could maybe accomplish this by setting the HTTP headers via a servlet filter (that only matches the page in question):

   public void doFilter(ServletRequest request, ServletResponse response, 
            FilterChain chain) throws IOException, ServletException { 
        try { 
            HttpServletResponse res = (HttpServletResponse) response; 
            // Set standard HTTP/1.1 no-cache headers.
            // Set standard HTTP/1.0 no-cache header.
            res.addHeader(...)             
            chain.doFilter(request, response); 
        }...
    }
Nic
  • 158
  • 8