Conal Tuohy wrote:


luca morlando wrote:


I've the following problem with Control Flow:
I was able to read a stream in the sitemap using <map:match pattern="*/getSomething">
<map:generate type="stream">
<map:parameter name="defaultContentType" value="text/xml"/>
</map:generate>


...

</map:match>

But now I need to read the same stream into flowscript function and I don't know how to do that!

I wrote this in sitemap:
<map:match pattern="*/getSomething">
<map:call function="main">
<map:parameter name="request" value="I'm able to give you a parameter but not a stream!"/>
</map:call>
</map:match>


but ... how to post stream?


If your flowscript needs access to the xml stream, try using
processPipelineTo in your flowscript to invoke the stream-generator.
or do the following:

importClass( Packages.org.apache.excalibur.source.SourceResolver );
importClass( Packages.org.apache.excalibur.source.Source );
importClass( Packages.org.apache.cocoon.components.source.SourceUtil );
importClass( Packages.org.apache.cocoon.xml.dom.DOMUtil );

function getRequestBodyDocument() {
        var resolver = null;
        var source = null;
        try {
                resolver = cocoon.getComponent( SourceResolver.ROLE );
                source = resolver.resolveURI(
                                       "module:request:inputStream" );
                var document = SourceUtil.toDOM( source );
                return document;
        } finally {
                if ( resolver != null ) {
                        if ( source != null )
                                resolver.release( source );
                        cocoon.releaseComponent( resolver );
                }
        }
}


-- Leszek Gawron MobileBox [EMAIL PROTECTED] http://www.mobilebox.pl

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



Reply via email to