cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mario Muja <mario.m...@delaval.com>
Subject Re: Nobody Knows HOW TO SAVE STREAM ON DISK!!
Date Wed, 12 Sep 2001 07:40:27 GMT
<html>
<head>
</head>
<body>
<br>
Is somebody out there, who wrote a serializer to write an XSP stream to disk?<br>
<br>
Thank you very much for your help.<br>
<br>
Mario Muja<br>
<br>
<br>
Karl &Oslash;ie wrote:<br>
<blockquote type="cite" cite="mid:NDBBLJFHIJLADOPPJBKFKEJFCJAA.karl@gan.no">
  <pre wrap="">there are ways to do this, but it involves a bit java hacking as i don't<br>know
so much about cocoon.<br><br>1: make your own serializer<br>---------------------------<br>that
sends the resulting stream to a file object instead of back to cocoon<br><br>this
should be pretty easy for 'poc' but a little harder for a production<br>version. a good
start would be to copy the source of the<br>org.apache.cocoon.serialization.TextSerializer
or<br>org.apache.cocoon.serialization.XMLSerializer give it your own name, modify<br>it
to save to disk instead of stream back to cocoon and then set this up as<br>you end
serializer in the pipeline<br><br><br>2: use saxon as a xslt transformer<br>----------------------------------<br><br>as
it has a feature to save output to disk (tip: &lt;saxon:output/&gt;)<br><br>regretfuly
you will have to read manuals about saxon and see if its possible<br>to use saxon as
a transformer in cocoon.<br><br><br>3: make a jsp or servlet catcher (e
asy, but not very smart to do)<br>-----------------------------------------------------------------<br>make
a jsp site that relays the output from your original pipeline, and<br>writes parts of
it to disk with the File object, this will work in a<br>quickhack maner, but is not
very clever as it imposes a big overhead.<br><br>try something like this in a
jspfile:<br>&lt;%<br>try { //try to read from url<br>	URL myurl = new
URL( <a class="moz-txt-link-rfc2396E" href="http://www.karl.no/">"http://www.karl.no/"</a>
); //&lt;- your<br><a class="moz-txt-link-freetext" href="http://someserver:8080/cocoon/test.xsp">http://someserver:8080/cocoon/test.xsp</a><br>
BufferedInputStream inn = new BufferedInputStream(myurl.openStream());<br>	BufferedWriter
out = new BufferedWriter( new OutputStreamWriter( new<br>FileOutputStream("output.txt")
) );<br>	for(;;) {<br>	     	int data = inn.read();<br>		if (data == -1)
{<br>			break;<br>			}<br>		else {<br>			out.write((char) data);<br>
		}<br>	
	}<br>	out.flush();<br>	}<br>catch(MalformedURLException mue) { System.out.println("Invalid
URL");}<br>catch(IOException ioe) { System.out.println("I/O Error - " + ioe);}<br>%&gt;<br><br>NB:
this is pseudo-code, i haven't testet if it's compiling! :-) buy a book<br>about java
programming, it will be well spent time/money if you are to work<br>with cocoon!<br><br><br>mvh
karl &oslash;ie<br><br><br></pre>
  <blockquote type="cite">
    <pre wrap="">-----Original Message-----<br>From: cib [<a class="moz-txt-link-freetext"
href="mailto:c.cib@laposte.net">mailto:c.cib@laposte.net</a>]<br>Sent: 10.
september 2001 20:30<br>To: Cocoon User Mail List<br>Subject: Nobody Knows HOW
TO SAVE STREAM ON DISK!!<br><br><br>Hi,<br>I've been sending message
everywhere and reading any book on jsp,<br>and nowhere it's told how I can get an xsp
to record, or update a file.<br>It's crazy!!<br></pre>
    </blockquote>
    <pre wrap=""><!----><br>hey man, beta software IS crazy :-) !!!<br><br><br>---------------------------------------------------------------------<br>Please
check that your question has not already been answered in the<br>FAQ before posting.
<a class="moz-txt-link-rfc2396E" href="http://xml.apache.org/cocoon/faqs.html">&lt;http://xml.apache.org/cocoon/faqs.html&gt;</a><br><br>To
unsubscribe, e-mail: <a class="moz-txt-link-rfc2396E" href="mailto:cocoon-users-unsubscribe@xml.apache.org">&lt;cocoon-users-unsubscribe@xml.apache.org&gt;</a><br>For
additional commands, e-mail: <a class="moz-txt-link-rfc2396E" href="mailto:cocoon-users-help@xml.apache.org">&lt;cocoon-users-help@xml.apache.org&gt;</a><br><br><br></pre>
    </blockquote>
    <br>
    </body>
    </html>


---------------------------------------------------------------------
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: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message