cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Goers" <>
Subject Re: InputStream as source or generator
Date Tue, 18 May 2004 23:44:41 GMT
I used Betwixt's SAXBeanWriter to convert my bean to a generator. I
believe this is more efficient since no "real" xml is ever created.

public class BetwixtGenerator extends AbstractGenerator
    protected ServiceManager manager;
    private Object           bean;

     * Sets up the BetwixtGenerator.
     * @param resolver the source resolver
     * @param objectModel the Cocoon object model
     * @param src ignored by the BetwixtGenerator
     * @param par ignored by the BetwixtGenerator
     * @throws ProcessingException
     * @throws SAXException
     * @throws IOException
    public final void setup(SourceResolver resolver, Map objectModel,
String src,
                      Parameters par)
        throws ProcessingException, SAXException, IOException
        super.setup(resolver, objectModel, src, par);

        Request request =
        this.bean =
        if (this.bean == null)
            throw new ProcessingException("No object was provided to

     * Generate XML data.
     * @throws SAXException
    public final void generate()
        throws SAXException
            SAXBeanWriter beanWriter = new
        catch (Exception e)
            getLogger().error("Cannot generate XML for " + bean, e);
            SAXException saxException = new SAXException(e.getMessage());
            throw saxException;

Craig Christophersen said:
> Can anyone point me in a direction of how to use an InputStream as either
> a Source or Generator in the pipeline? The StreamGenerator is just for
> request input from a post. I would like to use an inputstream from a DTO,
> bean, or ejb.
> I have created an action to instantiate a bean and can use the parameters
> retrieved as strings. I would like to get the inputstream(of xml data)
> into the pipeline.
> Craig Christophersen
> (406)496-6421

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message