On Aug 5, 2004, at 12:11 AM, Bruno Dumon wrote:

On Thu, 2004-08-05 at 05:55, Mark Lundquist wrote:
It would be slightly more elegant

"slightly" is an understatement IMHO, putting data in the session which shouldn't be there is just plain ugly.

Yes, it is butt-ugly. But lately I am trying to correct my idealist/perfectionist tendencies and become more pragmatic. Before, I would have said "this is a travesty, whatever it takes to right this wrong, it must be done!" :-)... so maybe I am overcompensating...



 to be able to passthe source data in directly to sendPage() instead
of stashing it inthe session, but that hardly seems to justify the
trouble of writing awhole damn generator

What you need is the module source combined with the flow-attribute input module.

The module source is a source which gets its data from an input module.

The usage is something like:

<map:generate src="module:flow-attribute:mything"/>

where 'mything' is the key used in the object passed to sendPage, ie
sendPage("...", {"mykey": someObject});

The type of someObject should be either an InputStream or a String. If
you have your data retrieved in a byte array you can easily wrap it in a
ByteArrayInputStream.


OTOH, if you have your data already as a DOM-tree or an object
implementing XMLizable, you can use the XModuleSource (still in
scratchpad).

That's beautiful. I was just looking for the flow-attribute module yesterday and couldn't find it, but I can see from my cocoon.xconf that this is because it's moved into the core, duh!!!


In this case I'm actually starting with a string, so doing this with the module source I can rip out my java code that builds an InputStream and then parses it. I love getting rid of code.

Thanks a lot.

You know, I just have to say this every so often, and I haven't said it for a while, so now it is time again: Cocoon just kicks total butt! There, that should do for a while. I know I'm preaching to the choir, but it's so true.

Thanks again,
~ml


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to