if i have ten projects, it's not useful to have one theme per project, i want have shared theme to store creator images and scripts and my images scripts and css. with this method table.js will have same url for all the projects and browser caching is used correctly.
actually to create .js or .css files, we use resources folder in the project. In the future we aim have resource folder shared between projects and to deposit css,js and images commun run with all our projects, with this methode the maintenance of these files is simplified and browsers cache fonctionnality is optimized because these files will have the same url not an url per project.
defaults themes and scripts generated by creator will have the same shared resources folder, and its URL is independent of the project.
I just wanted to thank you for this solution. I've posted a question regarding .js,.css and images files not being cached in internet explorer. Your post was very helpfull on cutting down the request on my server.
Just to add my two cents, I've changed your class a little by adding:
The idea is to avoid multiple Cache-Control tags on the response. Also I've moved the
chain.doFilter(req, res);
to the bottom of the method so I can use a another filter is necessary and override my response settings (but haven't tried yet ;)).
Thanks!
PS: My application is JSF using Woodstock components and developed on Netbeans 6.0. According to the documentation, the ThemeServlet should be filling the response header properly, however I've found that this is not true. In mos of the cases I get an expires date around 1969, and Cache-Control = No-Cache. Maybe a problem with my setup, but the filter is doing a great job anyway!