cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoff Howard <ghow...@crosswalk.com>
Subject RE: Generator How-To
Date Fri, 02 Aug 2002 15:51:47 GMT
I see your point - hide the source of those parameters from the generator,
which ultimately shouldn't care where they came from.  I think that I may
progress to that example rather than jump to it right off.  

My personal feeling as I get my mind around Avalon/Cocoon is that the good
abstracted architecture often has the unfortunate effect of making
everything seem more confusing and mysterious to beginners than it really is
(just like EJB).  Given that many people reading this tutorial may be
completely new to Cocoon, SAX, and Avalon - that's a lot to swallow all at
once.

One question: In your sitemap example implementing the parameter, I'm not
clear on the best way to get at multiple parameters that way - say,
?param1=foo&param2=bar

would something like this work? 

<map:match pattern="generator-example.xml">
      <map:act type="request">
  	   <map:parameter name="parameters" value="true"/>
	   <map:generate type="mygenerator">
		<map:parameter name="parametername1" value="{param1}"/>
		<map:parameter name="parametername2" value="{param2}"/>
 	   </map:generate>
      </map:act>
      <map:serialize type="xml"/>
</map:match>

Geoff

> -----Original Message-----
> From: Jens Lorenz [mailto:jens.lorenz@interface-projects.de]
> Sent: Friday, August 02, 2002 6:12 AM
> To: cocoon-docs@xml.apache.org
> Subject: Re: Generator How-To
> 
> 
> ----- 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