Re: T5: Stream Text File with StreamResponse

2008-02-21 Thread MoritzGilsdorf
Thanks a lot! There's just a little typo: OutputStreamWriter osw = new OutputStreamWriter(out); Davor Hrg wrote: > > ByteArrayOutputStream out = new ByteArrayOutputStream(); > OutputStreamWriter osw = new OutputStreamWriter(System.out); > velocityContext.put("desc", thi

Re: T5: Stream Text File with StreamResponse

2008-02-21 Thread Christian Gorbach
ok, what you will need is a datapump which converts an output stream to an input stream. See: http://ostermiller.org/convert_java_outputstream_inputstream.html Method 1 is the simplest: let velocity write to abytearrayoutputstream and use the byte array to construct an input stream object. voil

Re: T5: Stream Text File with StreamResponse

2008-02-21 Thread Davor Hrg
ByteArrayOutputStream out = new ByteArrayOutputStream(); OutputStreamWriter osw = new OutputStreamWriter(System.out); velocityContext.put("desc", this.description); template.merge(velocityContext, osw); osw.flush(); osw.close(); return new Byt

Re: T5: Stream Text File with StreamResponse

2008-02-21 Thread MoritzGilsdorf
The thing is that I don't know how to get my OutputStreamWriter into InputStream so that StreamResponse is able to stream it to the user. This is probably a very basic problem but I'm not very experienced with that. Right now there is nothing streaming but writing to System.out. But I want to do s

Re: T5: Stream Text File with StreamResponse

2008-02-21 Thread Christian Gorbach
sure. if you post your streaming snippet we can take a look... Hello, I'm trying to stream a text file I created with Velocity very similar to the way it is done http://wiki.apache.org/tapestry/Tapestry5HowToCreateADynamicPDF here but it doesn't work. The text is stored in a OutputStreamWriter