Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 56636 invoked from network); 1 Mar 2005 01:08:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 1 Mar 2005 01:08:18 -0000 Received: (qmail 89298 invoked by uid 500); 1 Mar 2005 01:08:08 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 89161 invoked by uid 500); 1 Mar 2005 01:08:08 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 89146 invoked by uid 99); 1 Mar 2005 01:08:08 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from smtp015.mail.yahoo.com (HELO smtp015.mail.yahoo.com) (216.136.173.59) by apache.org (qpsmtpd/0.28) with SMTP; Mon, 28 Feb 2005 17:08:06 -0800 Received: from unknown (HELO auburn) (jmitchtx@68.209.114.10 with login) by smtp015.mail.yahoo.com with SMTP; 1 Mar 2005 01:08:04 -0000 Message-ID: <03ca01c51dfb$0c40fe70$34000a0a@auburn> From: "James Mitchell" To: "Struts Users Mailing List" References: <20050228225715.CSGZ16598.viefep12-int.chello.at@gwextensa> Subject: Re: caching of message resources when using bean:message tag Date: Mon, 28 Feb 2005 20:07:31 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Yes, I have also written a database implementation or three ;) http://sourceforge.net/project/showfiles.php?group_id=49385&package_id=76369 In addition to this one, I have also written several impls for commons-resources (which Struts will be moving to very soon). There were license issues so I had to host them elsewhere (same link above) but I haven't released these as of yet. That's on my todo list ;) The workaround for Struts 1.1 and 1.2.x is to clear the hashmap of formatted messages. Look at org.apache.struts.util.MessageResources#getMessage(Locale locale, String key, Object args[]). In that method you'll see where if the formatted message (param replacement already done) is found, then that is returned. That certainly is a nice way to speed up things, but the impl fails to make that configurable, so you are just stuck with it :( My impl simply does formats.clear() on each call to getMessage(), so, in effect, unless the very next call to your getMessage() is asking for the last one you just gave it, the cache is (basically) disabled. You also might consider implementing your own cache or taking advantage of caching available via O/R Mapping tools like Hibernate. -- James Mitchell Software Engineer / Open Source Evangelist EdgeTech, Inc. 678.910.8017 AIM: jmitchtx ----- Original Message ----- From: "G�nther Wieser" To: Sent: Monday, February 28, 2005 5:57 PM Subject: caching of message resources when using bean:message tag hi, we are using struts version 1.2.4 and we implemented our own MessageResources and MessageResourceFactory. we needed to have a database based system for managing message resources for different locales so that we can change valued on the fly without the need to restart the app. these implementation work quite well, but we found one issue when using : it seems that the message with the key "whatever" gets cached somewhere. the first call to this bean with key="whatever" results in a getMessage() call to our implementation of MessageResources. the message gets delivered and inserted into the JSP. but all further calls to the message tag do NOT query MessageResources.getMessage(), so we assume that the message value is cached somewhere. what we see from the source code of the message tag is that TagUtils.message() is called. so far we haven't found anything that caches in TagUtils. and there's no caching in the message tag.. anyone an idea where the caching takes place? am i missing something fundamentally when i assume that it's possible (with my own implementation of MessageResources) to change message resources in struts dynamically during runtime? kr, guenther --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org