You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by ne...@swisslab.de on 2005/09/29 11:14:11 UTC
AW: Flow Script Output - SOLVED
Hello Jason,
That helped perfectly!
Thanks!
-----Ursprüngliche Nachricht-----
Von: Jason Johnston [mailto:cocoon@lojjic.net]
Gesendet: Montag, 26. September 2005 18:29
An: users@cocoon.apache.org
Betreff: Re: Flow Script Output
> Hello List,
>
> I ve a FlowScript which creates a XML tree.
>
> [snip]
>
> In this example I create a XML file in the servers local harddrice
> (c:/temp/) and afterwards send a request to another sitemap matching
> *.msg.
> This pipeline just shows the xml file on c:/temp. The XMLs name is the
> session ID.
>
> <map:match pattern="*.msg">
> <!-- {global:working-path} = c:/temp -->
> <map:generate type="file" src="{global:working-path}/{1}.xml"/>
> <map:serialize type="xml"/>
> </map:match>
>
>
> This method has some seriouse drawbacks.
> First and most important for me is, that it look quite silly. I think
> it is not supposed to be done this way. Would'nt it be much smarter to
> just drop the XML into the result stream that is send to the client
> anyway than to save it on disk?
Yes, definitely. Temporary server-side files suck. ;-)
It looks like what you're trying to do is to simply take a flowscript object
and have that object used as the source when generating the pipeline. This
can be done using the ModuleSource[1] in your map:generate, for example:
### In the flow: ###
var myXml = getXMLAsStringOrInputStream(); //logic done elsewhere
cocoon.sendPage("send-my-xml", {xml : myXml});
### In the sitemap: ###
<map:match pattern="send-my-xml">
<map:generate src="module:flow-attr:xml" />
<map:transform ... />
<map:serialize ... />
</map:match>
This should work as long as the flow object you pass it is an InputStream, a
String, or a byte array.
Hope that helps.
--Jason
[1]
http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/components/source/imp
l/ModuleSource.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org