I did something similar.  But I used Struts instead of a servlet.  Struts is a servlet 
too.  My Struts application and cocoon  are two parallel entries in tomcat's web apps. 
 Basically in your servlet you should forward it to a page like the following:
This page will not show in your browser.  It is doing a submit to cocoon pipeline with 
xml string as a form hidden field.  Cocoon will take it just like the StreamGenerator 
example and can do all kinds of things with it.  In my case, I created an Excel 
report, a rtf report and send email with rtf report as attachment.  

Hope this helps.

Charlene

<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Email Report</title>
</head>
<body onLoad="document.PostXML.submit();">
    <%@ page buffer="5" autoFlush="true" %>
    <%
      response.setHeader("Cache-Control", "no-cache");
      response.setHeader("Pragma", "no-cache");
      response.setHeader("Expires", "Thu, 29 Oct 2000 17:04:19 GMT");
      try {
    %>
      <form method="post" name="PostXML" 
action="http://localhost:8080/cocoon/samples/mail/sendmail/";>
        <input type="hidden" name="Foo" value="YOUR XML STRING HERE" />
        </form>
    <%
      } catch(Exception e) {
      e.printStackTrace();
    %>
    <h2>
      <center>
        <font color='red'>ERROR:</font>
        This page can not be accessed directly!
      </center>
    </h2>
    <%
      }
    %>
  </body>
</html>


 
 

-----Original Message-----
From: Uwe Gerger [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 24, 2003 8:53 AM
To: [EMAIL PROTECTED]
Subject: Re: Example with StreamGenerator


Hello Upayavira,
what I need is to send a XML stream via POST from a Java servlet to
Cocoon in order to use the stream generator! 

The XML stream is a String and I don't know what I have to do! Should I
append the string to the URL so that it looks like this:
localhost:8080/cocoon/test.xml<?xml version="1.0"><test></test> ????

Thanks in advance for any help
        Uwe

[EMAIL PROTECTED] schrieb:
> 
> Uwe,
> 
> Can you explain what your need is? Then we can see if we can find the
> best solution for you.
> 
> Regards,
> 
> Upayavira
> 
> On Thu, 24 Jul 2003 14:17:59 +0200, "Uwe Gerger" <[EMAIL PROTECTED]>
> said:
> > Do you mean the URL of the java servlet (in my case)? And then, what
> > does cocoon do?
> >
> > Thanks
> >       Uwe
> >
> >
> >
> > [EMAIL PROTECTED] schrieb:
> > >
> > > why not sending to cocoon the url of the asp which generate your xml?
> > >
> > > > does the stream generator only works with POST?
> > > >
> > > > If yes, I don't know how to do this from a java servlet. Should I append
> > > > the xml stream to the URL so that it looks like this:
> > > > localhost:8080/cocoon/test.xml<?xml version="1.0"
> > > > encoding="UTF-8"?><test></test>
> > > >
> > > > How did you do it in your ASP site?
> > > >
> > > > Thanks
> > > > Uwe
> > > >
> > > > [EMAIL PROTECTED] schrieb:
> > > > >
> > > > > Uwe,
> > > > >
> > > > > > i'm would like to use the StreamGenerator in my application. For this
> > > I
> > > > > > searched for an example in my Cocoon 2.0.4 distribution, but without
> > > > > > success! Can anybody help me?
> > > > >
> > > > > I cannot help you with an example, but I can tell you that I did build a
> > > > > working site that uses it in a total of 15 minutes.
> > > > >
> > > > > An ASP based site built an XML object and sent it by HTTP POST to the
> > > > > cocoon server. The Cocoon pipeline started with a stream generator and
> > > > > followed it by a SourceWritingTransformer which wrote the body of the
> > > > > post to an XML file on disc.
> > > > >
> > > > > The stream generator just outputs the XML that was sent as the body of
> > > > > POST. There's not much more to it than that.
> > > > >
> > > > > Regards, Upayavira
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > > --
> > > > Uwe Gerger                                _/_/_/   _/    _/  _/    _/
> > > > BMW AG, TG-53 IT-Technologie             _/   _/  _/_/_/_/  _/    _/
> > > > 80788 Muenchen                          _/_/_/   _/ _/ _/  _/ _/ _/
> > > > Tel: +49 89 382 35687                  _/   _/  _/    _/  _/_/_/_/
> > > > Fax: +49 89 382 49040                 _/_/_/   _/    _/  _/    _/
> > > > mailto:[EMAIL PROTECTED]
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > --
> > Uwe Gerger                                _/_/_/   _/    _/  _/    _/
> > BMW AG, TG-53 IT-Technologie             _/   _/  _/_/_/_/  _/    _/
> > 80788 Muenchen                          _/_/_/   _/ _/ _/  _/ _/ _/
> > Tel: +49 89 382 35687                  _/   _/  _/    _/  _/_/_/_/
> > Fax: +49 89 382 49040                 _/_/_/   _/    _/  _/    _/
> > mailto:[EMAIL PROTECTED]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

-- 
Uwe Gerger                                _/_/_/   _/    _/  _/    _/
BMW AG, TG-53 IT-Technologie             _/   _/  _/_/_/_/  _/    _/
80788 Muenchen                          _/_/_/   _/ _/ _/  _/ _/ _/
Tel: +49 89 382 35687                  _/   _/  _/    _/  _/_/_/_/
Fax: +49 89 382 49040                 _/_/_/   _/    _/  _/    _/
mailto:[EMAIL PROTECTED]


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


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

Reply via email to