tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Hamer" <p...@tohave.nl>
Subject RE: HOWTO disable Tomcat from caching dynamic picture
Date Sun, 01 Oct 2006 14:16:12 GMT
Hey John,

Tomcat does not do any caching. Try adding these HTTP headers:

response.addHeader("Pragma","no-cache"); // HTTP/1.0
response.addHeader("Cache-control","no-cache, no-store"); // HTTP/1.1

That's the official way. However, due to an IE4-IE6 bug, you might want to
replace the second one by:

response.setHeader("Cache-control","max-age=0"); // HTTP/1.1

More info see: http://forum.java.sun.com/thread.jspa?threadID=233446&start=0

Worked fine for me!

Regards,
Paul Hamer

management & development
paul@tohave.nl

toHAVE websolutions
www.tohave.nl
info@tohave.nl  

> -----Original Message-----
> From: John Mok [mailto:jmok@attglobal.net] 
> Sent: Sunday, 01 October 2006 02:46
> To: users@tomcat.apache.org
> Subject: HOWTO disable Tomcat from caching dynamic picture
> 
> Hi,
> 
> I am using Tomcat 5.5.17 with Sun JDK 5.0 Update 7 on CentOS 
> 4.3. I have 
> a servlet, namely BMPImageViewer, which retrieves a BMP image from 
> database with conversion into PNG format via JAI. The servlet is 
> referenced in XSL-FO for PDF generation.
> 
> My problem was that the image did not change even the image 
> in database 
> updated. I checked that the servlet BMPImageViewer worked 
> correctly and 
> loaded the correct image every time. The servlet outputs the 
> image with 
> header set to "no-cache" :-
> 
> response.setHeader("Pragma", "no-cache");
> response.setHeader("Expires", -1);
> 
> How to force Tomcat not to cache the dynamic image? and load 
> a new one 
> every time? I hope someone could help me out and advise how 
> to configure 
> Tomcat not to cache dynamic image.
> 
> Thanks a lot.
> 
> John Mok
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message