Return-Path: Delivered-To: apmail-myfaces-users-archive@www.apache.org Received: (qmail 63709 invoked from network); 5 Feb 2008 15:02:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Feb 2008 15:02:42 -0000 Received: (qmail 76669 invoked by uid 500); 5 Feb 2008 15:02:30 -0000 Delivered-To: apmail-myfaces-users-archive@myfaces.apache.org Received: (qmail 76636 invoked by uid 500); 5 Feb 2008 15:02:30 -0000 Mailing-List: contact users-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Discussion" Delivered-To: mailing list users@myfaces.apache.org Received: (qmail 76625 invoked by uid 99); 5 Feb 2008 15:02:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Feb 2008 07:02:30 -0800 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Feb 2008 15:02:12 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JMPJE-0000MM-OI for users@myfaces.apache.org; Tue, 05 Feb 2008 07:02:04 -0800 Message-ID: <15291128.post@talk.nabble.com> Date: Tue, 5 Feb 2008 07:02:04 -0800 (PST) From: Daniel Niklas To: users@myfaces.apache.org Subject: Re: Need Filter that caches resources - a more general Extensions Filter? In-Reply-To: <71235db40802010615m392216a6i244a1543ea3099e0@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: daniel.niklas@continentale.de References: <15226545.post@talk.nabble.com> <22182468.1201873112568.JavaMail.root@viefep15> <71235db40802010541l11f83448ge9687a069013f987@mail.gmail.com> <15227214.post@talk.nabble.com> <71235db40802010615m392216a6i244a1543ea3099e0@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org 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.