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:RE: Localization and caching
Date Tue, 11 Jul 2006 03:08:53 GMT
Hi Ard,

   I remove the <use-request-parameters> instructions everywhere and it is
still not working.

With the status generator, I can see what Cocoon is holding in the Cache,
but It doesn't seem to hold any key like locale.

Here is what I tried : 
- I added a virtual parameter called "foo" which contained the
localization parameters 
<map:parameter name = "foo" value = "{../locale}"/>
- I tried adding a virtual parameter called locale in the XSLT transformer
where I don't use it
<map:transform src = "stylesheet.xsl">
  <map:parameter name = "foo" value = "{../locale}"/> 
</map:transform>
- I tried modifying the pipeline parameters to introduce a parameter
called cache-key
<map:pipeline type = "caching">
 <map:parameter name = "cache-key" value = "{session:attr-locale}"/>
 ...
</map:pipeline>

None of those solutions seem to work. I am thinking about switching to
something else but with all the work I have done with Cocoon, I don't want
to do it.


What I suspect is that Cocoon is caching everything from the instruction
map:act : 
<map:pipeline>
 <map:act type = "locale">
   <map:match pattern = "index.xml"/>
   <map:generate src = "index.xsl"/>
   <map:transform type = "i18n">
    <map:parameter name = "locale" value = "{../locale}"/>
   </map:transform>
 </map:act>
</map:pipeline>

So I think that when I request a page, Cocoon just take the content in the
cache without thinking of the locale attribute in the i18n transformer. So
the locale is not the cachekey and is never defined explicitly in the
cache(StatusGenerator).


Thanks again for your help.


-----Original Message-----
From: "Ard Schrijvers" <a.schrijvers@hippo.nl>
To: <users@cocoon.apache.org>
Date: Sun, 9 Jul 2006 12:07:56 +0200
Subject: RE: Localization and caching

> 
> > Thanks a lot Ard!
> > 
> > I am using the locale action at before any "map:match". I am 
> > passing the
> > locale as parameter but not using it in the XSL stylesheets.
> > 
> > exemple:
> > <map:act type = "locale">
> >   <map:match pattern = "index.html">
> >     <map:generate src = "index.xml"/>
> >     <map:transform src = "index.xsl"/>
> >     <map:transform type = "i18n">
> >       <map:parameter name = "locale" value = "{../locale}"/>
> >     </map:transform>
> >     <map:serialize type = "xhtml"/>
> >   </map:match>
> > </map:act>
> > 
> > In the XSL stylesheet i transform the keys as : 
> > <i18n:text>exemple.author.name</i18n:text>
> > 
> > In the xslt transformer configuration I specified the parameters
> > <use-request-parameters>true</use-request-parameters>
> 
> This is off topic, but I strongly recommend to set this to FALSE, and
> declare all your used parameters with map:parameters...When crawlers
> come by, they tend to have arbitrary parameters in the url, implying
> with your configuration 2 things:
> 
> 1) Since all request parameters are taken in the cache key (because
> <use-request-parameters>true</use-request-parameters>), then when a
> request with arbitrary request parameter will never match a cachekey,
> having to generate your pipeline again
> 2) Your cache gets stuffed up with nonsense cachekeys with arbitrary
> values because of crawlers  
> 
> > 
> > The localeAction for cocoon 2.x is an action which injects the locale
> > parameters from the session, the request or the 
> > cookie(according to the
> > action configuration) if I'm right...
> > 
> > The locale selection is managed through some javascript and 
> > everything is
> > working well when I'm not using a pipeline which type is "caching".
> > 
> > I am not sure I'm doing anything the wrong way. Thanks for 
> > your response.
> 
> Can you do something for me? Clear your entire cache, use
> <use-request-parameters>false</use-request-parameters>, and do
> 
> 1) request with certain locale ---> generate the status
> (StatusGenerator, you know to find it?) and look in the EHDefaultStore
> part at the created cache key. 
> 
> 2) Do request with different locale --> look again at created cache
> key. Did it override the previous one, or do you now have a new one?? 
> 
> This should give you a clue about what is missing in the cachekey. That
> of course does not solve the problem, but can help you debug this
> problem (I am also not familiar with map:act type="locale", so sorry
> for not having direct answer). 
> 
> Ard
> 
> > 
> > Anybody there!
> > -----Original Message-----
> > 
> > > 
> > > > 
> > > > Hi everybody,
> > > > 
> > > >     We are writing a dynamic website with cocoon and with are 
> > > > confronted 
> > > > to some problems.
> > > > We would like all the pages to be cached at startup for 
> > all possible 
> > > > specified languages.  When the user change the locale, it 
> > should be 
> > > > reflected in all the application's pages.
> > > 
> > > Hmmm, you are caching every possible page at startup?? With 
> > a crawler
> > > or something? Or you mean only the homepages? Or all? How do you do
> > > all? And what if content changes? Do you have to re-cache 
> > everything?
> > > It looks like you are working like the "forrest" guys. 
> > Cocoon has many
> > > smart caching mechanism, like eventAware that make running 
> > live without
> > > warming up the caches is very well possbile
> > > 
> > > > 
> > > >     However the cache doesn't seem to be updated when the 
> > > > locale change. 
> > > > The same page is often returned and sometimes a page with the 
> > > > previous 
> > > > language settings.
> > > > 
> > > > 
> > > > Were are using Cocoon 2.1.9 and the localeAction with 3 languages
> > > > (Spanish, English and trench). We were looking at the 
> > > > CacheEventAction 
> > > > but it doesn't seem to be the way to go.
> > > 
> > > I am not aware of waht the localeAction does. But I can 
> > imagine it is
> > > at the end of your pipeline, right? And the localeAction does not
> > > implement CacheableProcessingComponent interface. So, now, I have
> to
> > > quess what your problem is, but I have a clue:
> > > 
> > > You do some generation part, then some xsl transforms, and then a
> > > localeAction..(hope i got it right)
> > > 
> > > And probably, the generation part and the xsl part is 
> > locale dependent.
> > > But, you dont use the locale in there (as a parameter). So, this
> > > implies, your cache is built up until the first not cacheable
> > > component...(I suppose, but am not sure, and have to sort 
> > it out if it
> > > remains a problem, that this also holds for map:actions and
> > > map:selectors and stuff)
> > > 
> > > Anyway, so your cache is build with a generation part and some xsl
> > > transformer, where the locale is not in it. Now, changing 
> > your locale
> > > will return the very same cache...solution: do the xsl 
> > transformation
> > > with an extra map:parameter, with name="foo" and value equal to the
> > > locale. You dont have to use this parameter in your xsl. It 
> > only makes
> > > sure, your cache key contains the locale (look in 
> > StatusGenerator for
> > > generated keys: probably, you dont see the locale in it)
> > > 
> > > Hope this helps you out,
> > > 
> > > Regards Ard
> > > 
> > > > 
> > > >     If someone could help, it would be great. We are kind of 
> > > > stuck with 
> > > > Cocoon as it is considered as a show stopper for the project.
> > > > 
> > > > Thanks in advance
> > > > 
> > > > -- 
> > 
> > 
> > ---------------------------------------------------------------------
> > 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