This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Does Tomcat cache CSS files?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a personal Java-backed website I'm building with Tomcat, and I've run into an annoyance. After making some changes to a stylesheet, when accessing the website from a browser I was getting the old version of the css file. I assumed it was just the browser (Firefox) that was caching the file, but I've tried clearing the browser's cache and it has not helped. If I look at the file on the server or type the url of the css file in my browser, I see the updated version, but when examining it through Firebug I see the old version (and by looking at the rendered page it is obvious that it is using the old version). To rule out Firebug I have tried turning it off and closing/reopening Firefox and loading the page again, but that has not helped. Especially strange is that I tried changing the name of the css file (and obviously also changing link tag on the page as well) but this has not helped. At this point I am wondering if Tomcat's servlet container stores compiled JSPs somewhere, and if that is true perhaps it is storing linked stylesheets as well.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat does nothing magic with CSS files, just serves them just like all other static resources.

Surely the caching is occuring somewhere else.

Bill
 
Bartender
Posts: 20934
127
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To put it even more bluntly, Tomcat doesn't cache, period.

Is there maybe a caching proxy server between the client and Tomcat?

A trick that I use to get updated cache and CSS in Firefox is to instruct the browser to fetch the updated file directly. That is, I type the updated file's URL directly into the navigation bar so that it displays in a web page all its own. Sometimes I have to give it an extra kick by pressing the Refresh button (F5) once it's loaded to force an update, but that usually works. I can then generally go back and request the page that references the updated resource and expect it to work.
 
Tim Hagberg
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I apologize for the late response. It turns out there was some malformed CSS that apparently Firefox was simply ignoring. I'm no expert on this, but I'm assuming CSS files must be stored somewhere on the DOM, and if that's the case, Firefox wasn't putting the malformed CSS on the DOM. That would explain why I was seeing the new CSS entries when putting in the full URL to the stylesheet in the address bar. Thank you both for your responses and advice.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!