cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: How to inject the result of an action into a generator
Date Wed, 26 Mar 2008 04:46:34 GMT
On 25.03.2008 22:45, shai200 wrote:

> Alright, so since you're already in the groove of answering my questions
> (thanks btw), I would need my generator class to also have access to the
> entire Request Map (preferably in the form Map<String,String[]> where the
> String[] key is the set of values in case a value is declared twice, but
> that's not so crucial) as well as the Session object / map... how would I go
> about that?

Generators are SitemapModelComponents [1] and so have access to a map 
that we call object model in the setup(..) method. If you extend from an 
existing generator (ServiceableGenerator [2] is mostly a reasonable 
choice) you only have to override the setup(..) method and the 
generate(..) method. You can access request from the object model using 
the ObjectModelHelper [3]: ObjectModelHelper.getRequest(objectModel);

Disclaimer: What I explained is pretty much the Cocoon 2.1 way. If you 
use 2.2 this will still work but there might be better ways to do that 
like component setup through Spring. But I guess this does not make 
setup(..) obsolete, only additional component configurations.

Joerg

[1] 
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/sitemap/SitemapModelComponent.html
[2] 
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/generation/ServiceableGenerator.html
[3] 
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/environment/ObjectModelHelper.html

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


Mime
View raw message