Is somebody out there, who wrote a serializer to write an XSP stream to disk?

Thank you very much for your help.

Mario Muja


Karl Øie wrote:
[EMAIL PROTECTED]">
there are ways to do this, but it involves a bit java hacking as i don't
know so much about cocoon.

1: make your own serializer
---------------------------
that sends the resulting stream to a file object instead of back to cocoon

this should be pretty easy for 'poc' but a little harder for a production
version. a good start would be to copy the source of the
org.apache.cocoon.serialization.TextSerializer or
org.apache.cocoon.serialization.XMLSerializer give it your own name, modify
it to save to disk instead of stream back to cocoon and then set this up as
you end serializer in the pipeline


2: use saxon as a xslt transformer
----------------------------------

as it has a feature to save output to disk (tip: <saxon:output/>)

regretfuly you will have to read manuals about saxon and see if its possible
to use saxon as a transformer in cocoon.


3: make a jsp or servlet catcher (e asy, but not very smart to do)
-----------------------------------------------------------------
make a jsp site that relays the output from your original pipeline, and
writes parts of it to disk with the File object, this will work in a
quickhack maner, but is not very clever as it imposes a big overhead.

try something like this in a jspfile:
<%
try { //try to read from url
URL myurl = new URL( "http://www.karl.no/" ); //<- your
http://someserver:8080/cocoon/test.xsp
BufferedInputStream inn = new BufferedInputStream(myurl.openStream());
BufferedWriter out = new BufferedWriter( new OutputStreamWriter( new
FileOutputStream("output.txt") ) );
for(;;) {
int data = inn.read();
if (data == -1) {
break;
}
else {
out.write((char) data);
}
}
out.flush();
}
catch(MalformedURLException mue) { System.out.println("Invalid URL");}
catch(IOException ioe) { System.out.println("I/O Error - " + ioe);}
%>

NB: this is pseudo-code, i haven't testet if it's compiling! :-) buy a book
about java programming, it will be well spent time/money if you are to work
with cocoon!


mvh karl øie


-----Original Message-----
From: cib [mailto:[EMAIL PROTECTED]]
Sent: 10. september 2001 20:30
To: Cocoon User Mail List
Subject: Nobody Knows HOW TO SAVE STREAM ON DISK!!


Hi,
I've been sending message everywhere and reading any book on jsp,
and nowhere it's told how I can get an xsp to record, or update a file.
It's crazy!!

hey man, beta software IS crazy :-) !!!


---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>





---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. 

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



Reply via email to