cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Hunsberger <peter.hunsber...@gmail.com>
Subject Re: POST XML to cocoon protocol
Date Thu, 27 Jan 2005 15:18:46 GMT
n Thu, 27 Jan 2005 00:04:22 -0500, Irv Salisbury III <irv@dotech.com> wrote:
> I want to use the CIncludeTransformer to call another pipeline and pass
> it XML using the POST mechanism.  Before posting this question, I tried
> to make my way through the Source code, eventually finding my way to the
> SitemapSource class.  It doesn't look like the cocoon: protocol allows
> for POST.  Is this the case?
> 
> I guess a side question is, is there a better way to pass XML to another
> cocoon pipeline as input to it.  It is pretty easy to call another
> pipeline and get its output, but I want to pass XML to another cocoon
> pipeline.
> 
> I'd be fine with a solution that uses flowscript.
> 

Don't have time to figure out exactly what you want, but from
flowscript you can invoke another pipeline using processPieplineTo.
Eg:

    var sourceURI = "run/_validate/"+collection;
    var destinationURI = "xmodule:request-attr:validate";

    var resolver = null;
    var destination = null;
    try {
        resolver = cocoon.getComponent(
Packages.org.apache.cocoon.environment.SourceResolver.ROLE );
        destination = resolver.resolveURI( destinationURI );
        output = destination.getOutputStream();
        cocoon.processPipelineTo( sourceURI, {}, output );
        output.close();
        }
    }
    finally {
        if (destination != null) {
            resolver.release( destination );
        }
        cocoon.releaseComponent( resolver );
    }

As others note, you can set a requestAttribute in the pipeline and
have the generator of the other pipeline pick it up, you can also
communicate back to the flowscript from the invoked pipeline this way,
Eg:

       cocoon.request.setAttribute( "y", y );

or

       var x =  cocoon.request.getAttribute( "x" );

where the request attributes can be any object (more or less)...

-- 
Peter Hunsberger

Mime
View raw message