Two Servlet Filters Every Web Application Should Have
Subject:   MIME types and Servlets that generate binary data
Date:   2003-12-15 09:02:11
From:   anonymous2
Response to: MIME types and Servlets that generate binary data

For example, say that part of a web app displays a calendar whose events are particular to the user and whose month is particular to some session variable. If one wanted to use a caching filter to reduce the time of calendar generation, it seems that the filter would have to dig through session variables to determine what user is logged in and what month they have chosen. This is not difficult, but when one has a customized situation like this, it seems that the CacheFilter will have to be customized as well. I'm interested in knowing if there is a way to do this in a more generic way - namely, so that a caching filter can be used in such a situation without having to tailor it so that it works *only* in this situation.
Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • MIME types and Servlets that generate binary data
    2004-01-07 18:52:12  jfalkner [View]

    Sure, you could solve this problem a few ways. One way is to cache based on URL parameters (which I think this filter does...) and simply put the information you care about in the URL.

    Another way would be to add another level of abstraction to the cache filter, e.g. allow cache-control objects to be registered to the filter, then have the filter both check the URL/headers/etc and the registered cache-control objects. It would then be up to you to code cache-control objects (say one for your calendar) and register them with the filter.