Jim,
We have been successful using either a filter.
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
try {
HttpServletResponse res = (HttpServletResponse) response;
res.addHeader("Pragma", "no-cache");
res.addHeader("Cache-Control", "no-cache");
res.addHeader("Expires", "-1");
chain.doFilter(request, response);
}
finally {
}
}
or a pageBeginRender() override
public void pageBeginRender(PageEvent event) {
if (event.getRequestCycle().isRewinding()) {
return;
}
HttpServletResponse res =
event.getRequestCycle().getRequestContext()
.getResponse();
res.setHeader("Pragma", "no-cache");
res.setHeader("Cache-Control", "no-cache");
res.setHeader("Expires", "-1");
}
Either one has worked great for us. We prefer the servlet filter approach
because it takes servlet code out of our page implementations.
What makes you think this has no effect? If you use a http traffic monitor,
such the tool available from axis you will discover that your headers are
being transmitted.
http://ws.apache.org/axis/java/user-guide.html#AppendixUsingTheAxisTCPMonito
rTcpmon
Richard
-----Original Message-----
From: JIM WEAVER [mailto:[EMAIL PROTECTED]
Sent: Monday, September 12, 2005 9:34 AM
To: Tapestry users
Subject: Disable HTML page caching in Tapestry 3.0.3 application
This is browser client-side caching I'm trying to disable rather than
Tapestry server-side page cachine.
For our JSP apps, either a custom tag or servlet filter is used to
execute
the something like:
httpResponse.setHeader("Pragma", "no-cache");
httpResponse.setDateHeader("Expires", 0);
httpResponse.setHeader("Cache-Control", "no-cache");
I tried that code in a servlet filter with our tapestry app, and it
executes
but appears to have no effect. I've also tried adding it to
pageBeginRender
of select pages, and using meta tags in the html header instead of
setting
the response. All no effect.
I suspect my problem has nothing to do with Tapestry, but I can't figure
what I'm doing wrong.
Anyone doing this currently?
jim
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]