You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Gritsenko <vg...@acm.org> on 2001/03/18 20:26:17 UTC

Re: Will cocoon work in this situation? => XML to PDF on fly in one Serlet, no files, baby

Brief:

I wanted to generate XML in Servlet dynamically and pass it to Cocoon
somehow
without resorting to saving this xml to file and redirecting user's browser
to URL of this file.

I have found another
(better, easier, safer? than hacking Cocoon Producer)
solution.
Have found but not tried yet :)

See source code attached.

In few words:

I am a Servlet,
I have an XML document in form of String,
I wrap my HTTPRequest and  my XML document as String,
    into provided CocoonServletRequest,
        (I think it tricks Cocoon to think it is a file, since it fakes
implementation of getPAthInfo method, so Cocoon         thinks it is a file
and invokes it's FileProducer)
I instantitate CocoonEngine in myself,
I invoke 'handle' method of this engine, while passing to it
    my cocoonized wrapped Request,
    my own Response.

The effect is that my Response becomes Cocoon's  Response, so that whoever
receives it receives what Cocoon produced.

Viktor

PS.
This article have lead me to this solution:

http://www.javaworld.com/javaworld/jw-02-2001/jw-0209-xmlj2ee.html




----- Original Message -----
From: Jon Brisbin <br...@ipa.net>
To: <co...@xml.apache.org>; Gritsenko <vg...@acm.org>;
<bb...@xmission.com>
Sent: Saturday, March 17, 2001 5:33 PM
Subject: RE: Will cocoon work in this situation?


>
> You might check the source code for a producer (start with
> org/apache/cocoon/producer/ProducerFromFile) and check out incorporating
> your servlet code as a producer instead of generating a file and
> redirecting...the configure cocoon.properties to use your producer instead
> of the producerfromfile...
>
> for the dynamic xml, consider checking into the producer, with the caveat
> that you'll be producing an xml file from a URL instead of from the file
as
> the ProducerFromFile does...don't remember the syntax right off, but
xerces
> can read input from a url...
>
> Jon Brisbin
> www.jbrisbin.net
>
>
> blah> -----Original Message-----
> blah> From: Gritsenko [mailto:vgritsenko@acm.org]
> blah> Sent: Friday, March 17, 2000 4:23 PM
> blah> To: cocoon-users@xml.apache.org
> blah> Subject: Re: Will cocoon work in this situation?
> blah>
> blah>
> blah> I have similar ineterest.
> blah>
> blah> I do generate XML dynamically, in servlet, then save it to file,
then
> blah> redirect to this xml file.
> blah>
> blah> I would prefer to have Cocoon to take over XML output stream servlet
> blah> generates,
> blah> rather then taking over the request from browser to xml file.
> blah>
> blah> Anybody knows how?
> blah>
> blah>
> blah>
> blah> Viktor
> blah>
> blah>
> blah>
> blah>
> blah> ----- Original Message -----
> blah> From: Brian Bray <bb...@xmission.com>
> blah> To: <co...@xml.apache.org>
> blah> Sent: Saturday, March 17, 2001 3:18 PM
> blah> Subject: Will cocoon work in this situation?
> blah>
> blah>
> blah> >
> blah> >
> blah> > Here is what I'm trying to do:
> blah> >
> blah> > I need to generate dynamic XML from ColdFusion and/or PHP.
> blah> I'm using
> blah> > mod_coldfusion and/or mod_php under apache.  I want to have
> blah> the server be
> blah> > responsible for performing XSLT on the XML generated.
> blah> >
> blah> > To the best of my knowledge it is not possible to have
> blah> > mod_php/mod_coldfusion pass its generated content onto
> blah> another apache
> blah> > processor. Is this true?  Could cocoon somehow monitor the
> blah> mime types
> blah> > genrated by mod_php/mod_coldfusion and pick out the
> blah> text/xml ones and
> blah> > process them?
> blah> >
> blah> > My other idea was to try to use mod_proxy as a reverse
> blah> proxy server, and
> blah> > maybe integrate cocoon in there somewhere.  That would also
> blah> be nice if in
> blah> > the future the site got huge the XSLT processing could be put on a
> blah> > seperate machine from the mod_php/mod_coldfusion processing.
> blah> >
> blah> > Any ideas?  Has something like this already been implemented?
> blah> >
> blah> > Thanks in advance,
> blah> >
> blah> > Brian Bray
> blah> >
> blah> >
> blah> >
> blah> > --
> blah> > Brian Bray
> blah> > bbray@xmission.com
> blah> >
> blah> >
> blah> >
> blah> >
>
blah> ---------------------------------------------------------------------
> blah> > Please check that your question has not already been answered in
the
> blah> > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> blah> >
> blah> > To unsubscribe, e-mail: <co...@xml.apache.org>
> blah> > For additional commands, e-mail:
<co...@xml.apache.org>
> blah> >
> blah>
> blah>
>
blah> ---------------------------------------------------------------------
> blah> Please check that your question has not already been answered in the
> blah> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
> blah>
> blah> To unsubscribe, e-mail: <co...@xml.apache.org>
> blah> For additional commands, e-mail: <co...@xml.apache.org>
> blah>
>
>
> ---------------------------------------------------------------------
> Please check that your question has not already been answered in the
> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
> To unsubscribe, e-mail: <co...@xml.apache.org>
> For additional commands, e-mail: <co...@xml.apache.org>
>
>