cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yves Zoundi <>
Subject [FIX] I18nTransformer [CACHING PIPELINE]
Date Sat, 09 Sep 2006 22:35:04 GMT
Hi everybody,

   Thanks to Ard, I am able to provide a fix for the I18nTransformer. 

   My problem was that I am using a session to track the user locale and a
caching pipeline. I am using the LocaleAction to intercept the locale
value via the module session-attr : 

<map:act type = "locale">
 <map:match pattern = "test.html">
	<map:generate src = "test.html"/>
	 <map:transform type = "i18n">
	<map:parameter name = "locale" value = "{session-attr:locale}"/>
      <map:serialize type = "html"/>
   Without caching(<map:pipeline type='caching'>...</map:pipeline>) the
problem doesn't occur but the performance is poor.

 The issue with the i18ntransformer is that generated cache keys are not
unique. A simple solution which might not be the best is: 

package org.fix.cocoon.transformation;

import org.apache.cocoon.environment.*;
import org.apache.cocoon.transformation.I18nTransformer;

 * @author Yves Zoundi
public class I18nTransformerFix extends I18nTransformer {    
    public Serializable getKey() {
        StringBuffer buff = new StringBuffer();
	buff.append("" + System.currentTimeMillis());
        return buff.toString();

It would be good to have a I18nSessionEnabledTransformer so that the cache
keys are always associated to the session. This would also prevent the
i18ntransformer to generate a huge amount of keys.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message