cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Lorenz" <jens.lor...@interface-projects.de>
Subject Re: Generator How-To
Date Fri, 02 Aug 2002 10:11:51 GMT
----- Original Message ----- 
From: "Geoff Howard" <ghoward@crosswalk.com>
To: <cocoon-docs@xml.apache.org>
Sent: Thursday, August 01, 2002 10:00 PM
Subject: RE: Generator How-To


> Sure.  Here you are - comments welcome.
> 
> Geoff

Geoff,


>From what I can see, you are proposing to access the Request
from the Generator directly.

I think your (really good) How-To should discuss the difference
between (Avalon) Parameters and directly accessing the Request.
I feel this is important so that Cocoon is extended the way it
is meant to be. The last word on this, should of course have some
Cocoon developer.

So, what am I talking about ? I assume you want to access the
Request in order to send your Generator some parameters. While
this is a possible way, a much better one is to make your
Generator implement Parameterizable and get Parameters from there.
To send Request parameters to your generator you just write
something like this within your sitemap:

<map:match type="request" pattern="parametername_in_request">
  <map:generate type="mygenerator">
    <map:parameter name="parametername" value="{../1}"/>
  </map:generate>
</map:match>

or something similar. With InputModules you can then get
parametervalues for your Generator out of the Request, Session
or Database without having to touch your Code of the Generator.
And even better the name of the Request-Parameter can be something
else or could be just a Pointer into a Database where the value for
Generator-Parameter is. Short: You don't mix Request-Parameters
with Generator-Parameters.

The only Generator which has to access Request directly is
the RequestGenerator.
All other should take the detour via sitemap in order to be
more flexible. (runtime performance should be hardly affected by this)


I hope this mixture of Cocoonian and Avalonian was understandable.



Jens

-- 

jens.lorenz at interface-projects dot de

interface:projects GmbH                             \\|//
Tolkewitzer Strasse 49                              (o o)
01277 Dresden                               ~~~~oOOo~(_)~oOOo~~~~
Germany


Mime
View raw message