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 something like this:
StreamResponse onSubmitFromDescription() { InputMaker iMaker = new InputMaker(description); InputStream is = iMaker.makeDescription(); return TextStreamResponse(is,"Description"); } Then, this method should return, of course, an InputStream: public void makeDescription(){ try { configure(engine); } catch (Exception e) {} try { Template template = Velocity.getTemplate("src/main/resources/templates/description.vm"); VelocityContext velocityContext = new VelocityContext(); OutputStreamWriter osw = new OutputStreamWriter(System.out); velocityContext.put("desc", this.description); template.merge(velocityContext, osw); osw.flush(); osw.close(); } catch (Exception e) {} } And, to be complete, my TextStreamResponse Class: public class TextStreamResponse implements StreamResponse { private InputStream is; private String filename = "default"; public TextStreamResponse(InputStream is, String filename){ this.is = is; this.filename = filename; } public String getContentType() { return "text/plain"; } public InputStream getStream() throws IOException { return is; } public void prepareResponse(Response arg0) { arg0.setHeader("Content-Disposition", "attachment; filename=" + filename + ".txt"); } } Thanks a lot for helping me with that! Moritz Christian Gorbach wrote: > > 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 object. >> Is it possible to stream something else than binary data with tapestry? >> >> Thanks, >> >> Moritz >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/T5%3A-Stream-Text-File-with-StreamResponse-tp15611200p15611835.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]