Leszek Gawron wrote:
Sylvain Wallez wrote:
<page jx:cache-key="news.id" jx:cache-validity="com.my.NewsHelper.getValidity(news.urgency)">
One question: if this NewsHelper is NOT an avalon component (or object instantiated by flow.createObject) then it doesn't have acces to any backend logic or data (for example database that stores expiration time for different news services). Would it be possible to instantiate this object via flow.createObject analogy?
Two anwsers to this:
- we could add a builtin "createObject()" to the JXG expression language, thus directly solving your problem. I don't think this is a good idea as it opens the door to too much code in the template.
- the NewsHelper object can be created in the flow and passed as viewData. This keeps things clean: the flow gives necessary data to the view, and the view pulls what it needs from that data, including means to compute the cache information.
Sylvain
-- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
