I agree that i dont think the 'in memory' Tomcat solutions is what i'm currently after, its very much a Tomcat 'heading stamp' issue i think. Interesting point you raise though regarding pushing the statics to an external server. Not ideal from a deployment perspective but that would certainly solve it :). Interesting points you raise too regarding the reasoning behind the 'default expiry' date, makes a lot of sense but just a little frustrating for simple static page assets.
Bill Barker-2 wrote: > > > "Caldarale, Charles R" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >>> From: David Smith [mailto:[EMAIL PROTECTED] >>> Subject: Tomcat caching of static resources? >>> >>> is it possible to cache static images and .js files in Tomcat? >> >>Think about what you just asked for: how would caching static resources in >>the server avoid them being downloaded by >the browser? It's the browser >>that must cache the information to avoid the redundant downloads. >> > There are settings in Tomcat that control server-side caching of static > resources (i.e. Tomcat serves up an in-memory copy of frequently requested > static resources). I really can't recommend this for "large .js files" on > a > production server however. If you must do this, check out the Tomcat docs > for configuring a <Resources .../> element. However, the OP is probably > better off enabling the sendfile options on either the NIO or APR > Connector. > >>> When i look at the browser cache it looks like the browser >>> is downloading all page assets for every call, including some >>> very large .js files. >> >>As stated in one of the (correct) responses to the article you referenced: >> >>"So the first thing is to get control of the cache headers. Without them, >>the cache can not know what to do." >> >>What are you doing to control the headers? What headers are being used for >>the large .js files? >> > The article is referring to the fact that Tomcat adds cache headers by > default to any page protected by a <security-constraint> to prevent > someone > else from stealing it from an intermediate proxy. The default settings > are > extremely aggressive, resulting in regular posts on this list of the form > "My secured pdf file can't be displayed in IE". If the article applies to > the OP, it may just be easier to move the .js files to a non-secured > location. If you take the advice in the article, then you are telling > Tomcat that the webapp programmer is taking full control of the cache > headers, so you are on your own in terms of security. > > >>> but the solution didn't resolve the problem (especially if >>> deploying via war files) >> >>The original author of the article is clearly unfamiliar with Tomcat, >>caching, and security (e.g., not knowing where a >context.xml file goes, >>and erroneously stating it doesn't work with a .war file). >> >>> i cant believe there isn't a standard Tomcat configuration for this? >> >>For what? Caching static resources on the server end doesn't alter the >>amount of network traffic generated. >> >>- Chuck >> >> >>THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY >>MATERIAL and is >thus for use only by the intended recipient. If you >>received this in error, please contact the sender and delete the e->mail >>and its attachments from all computers. > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Tomcat-caching-of-static-resources--tp20932874p20954097.html Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]