Hi,

Working on the caching feature, i found out the following:

The TrinidadResourceServlet has already build in Cache-Control. It sets the 
expires header to "+ 1 year". This is good in case of requesting
js-libraries, 
because theses generated files has the trinidad version as suffix in its 
filename. (e.g. "adf/jsLibs/Common1_0_5.js")

There isn't a suffix for image requests. This will be a problem, when images 
changes in a future version. (e.g. "/adf/images/t.gif"). 

The file "t.gif" seems to be a special case, because this is part of the 
XhtmlRenderer and is used for generating gabs!? Other images, e.g. 
"adf/images/dfb.gif", are part of the skin. There will be the same problem,
when 
using trinidad standard skin.

TrinidadResourceServlet, Line 458:

      // We set two headers: Cache-Control and Expires. // This combination
lets 
      browsers know that it is // okay to cache the resource indefinitely.

      // Set Cache-Control to "Public". response.setHeader("Cache-Control", 
      "Public");

      // Set Expires to current time + one year. long currentTime = 
      System.currentTimeMillis();

      response.setDateHeader("Expires", currentTime + ONE_YEAR_MILLIS);

      
I'm using weblets, to load resources. You can enable caching for weblets,
too. 
The documentatin says:

"Weblets use versioning to leverage the browser cache behavior so that
packaged 
resources can be downloaded and cached as efficiently as possible. The
browser 
only needs to check for new updates when the cache has been emptied or when
the 
component library has been upgraded at the web server."

To enable caching, you have to provide a version number in your
weblets.config. 
When you provide a version, the generated urls are containing version 
information, too. The version number could be the same as the version number
of 
the corresponding jar.

WebletResponseImpl, Line 82 (weblets 0.4)

    long now = System.currentTimeMillis(); long never = now + 1000 * 60 * 60
* 
    24 * 365; _httpResponse.setDateHeader("Expires", never);

(see https://weblets.dev.java.net/trunk/shortdoc/introduction.html)

I don't have other static resources. For this reason i don't need another 
filter, that adds cache control headers or something similar.

Best regards
Daniel
-- 
View this message in context: 
http://www.nabble.com/Need-Filter-that-caches-resources---a-more-general-Extensions-Filter--tp15226545p15291128.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to