cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yves Zoundi <bibl...@hermes.ulaval.ca>
Subject RE: [SOLUTION] Localization(i18n), session and Caching
Date Fri, 01 Sep 2006 13:57:48 GMT
Hello Ard,

   I fixed the problem. I think the issue was the fact that the locale
variant was always null or sometimes undefined. I removed it from the
i18ntransformer code and it is all cached and working correctly and
everything is maintnainetd in the user session. Thanks again. 

Excerpt from my I18nTransformer2Class
---------------------------------------------------
public java.io.Serializable getKey() {
        StringBuffer key = new StringBuffer();
        if (catalogue != null) {
            key.append(catalogue.getLocation()[0]);
        }
        key.append("?");
        if (locale != null) {
            key.append(locale.getLanguage());
            key.append("_");
            key.append(locale.getCountry());
// key.append("_");
//            key.append(locale.getVariant());
        }
        return key.toString();
    }

I will try to use again the LocaleAction and remove my LangAction class to
see if everything is working as it should.

If you have suggestions for custom authentication handler in Apache Cocoon
, please let me know and I will try to improve my "simple redirect action".

I know I could implement a custom authenticator, but I am not sure of the
way to go(the sitemap.xmap configuration and the custom handler
declaration). Correct me if I am wrong, the custom handler is the custom
authenticator I will create.

Thanks again for your quick replies Ard!

-----Original Message-----
From: "Ard Schrijvers" <a.schrijvers@hippo.nl>
To: <users@cocoon.apache.org>
Date: Fri, 1 Sep 2006 15:03:52 +0200
Subject: RE: [SOLUTION] Localization(i18n), session and Caching

> 
> > 
> > Hi all,
> > 
> > Thanks to all that helped me in the right way especially Ard 
> > Schrijvers. I
> > managed to solve my problem with caching, I18n Transformer 
> > and the session
> > locale.
> > 
> > The i18n transformer is cacheable and so the cocoon cached 
> > response is not
> > always updated when using the LocaleAction.
> > 
> > I choose the following path : 
> > - I created a simple Action to change the Locale : it 
> > analyses the request
> > or the session and store the locale in the session and return a map
> > containing the session locale.
> > - I created a I18nTransformer which is not cacheable based on 
> > the existing
> > I18nTransformer. I could have looked at the sourceValidity I 
> > think but I
> > am not sure.
> 
> Don't think the problem is in there. The I18nTransformer return a
> NOPValidity, which just means: I am valid, no matter what [1].
> 
> > I would have like to create a SourceValidity 
> > which look for
> > the locale in the session. If i have enough time I will give it a
> try.
> > 
> > My web site now behaves correctly with a caching pipeline. Everything
> > cacheable is cached except the I18nTransformer.
> 
> Good to hear! Since you now have already your own I18nTransformer
> version, you could try to fix the following for your case: I think for
> some reason, this part in the I18nTransformer,
> 
> /**
>      * Implemenation of CacheableProcessingComponents.
>      * Generates unique key for the current locale.
>      */
>     public java.io.Serializable getKey() {
> 
> 
> did not create unique keys for you for different locales. So, every
> locale ended up in the same cachekey (you can verify this with the
> statusgenerator). If you still want to fix it, and make the I18n
> cacheable, you should make sure that different locales end up in a
> different key.
> 
> Regards Ard
> 
> 
> [1]
> http://excalibur.apache.org/apidocs/org/apache/excalibur/source/impl/va
> lidity/NOPValidity.html 
> 
> 
> 
> > 
> > PS: I needed to have authentication too. A simple way was to provide
> a
> > custom authentication was to create an action and use the redirector.
> > 
> > Thanks again everybody
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message