Web tier: servlets, JSP, Web frameworks: Playing with Caching

  1. Playing with Caching (2 messages)

    HI For my application i have a caching mechansim whcih sets the expiry date to the static contents.(js,css and image files). For this i have a Filter class whcih extends javax.servlet.Filter whcih sets the expiry date. httpservletresponse.addDateHeader("Expires", 0); But in case i change the a js file in the future, then i want this file to be requested again from the server though it has been cached prevoisly. I tried to inlude public long getLastModified(HttpServletRequest req)in my jsp but doesnt even get called.Not sure How to handle this? Is there any other mechanism to handle such cases?

    Threaded Messages (2)

  2. Elaborate?[ Go to top ]

    Hi, I'm not sure I understand what your problem is. Is it your httpfilter that caches your resource files (js, css etc..)? And when a new file is uploaded you need the server to flush the cache? First option: Is that cache needed? Moving files in and out of cache isn't cheap. Skip the cache. Second option: Let the filter decide what to do. Every day, when the first request enters: Flush the cache. Third option: Make an url that activates a servlet that flushes your cache.
  3. Re: Playing with Caching[ Go to top ]

    See cache filter in JSOS: http://www.servletsuite.com/servlets.htm