Hi I just copied your code and it works for me. I have tried it on 5.2.6.
Are you sure your onSubmit action is getting called. Can you put a break point or simply a log message so see if it is getting called On Sat, Sep 3, 2011 at 4:04 AM, hese <1024h...@gmail.com> wrote: > > @Thiago - I am using Tapestry 5.1.0.5. > > @Martin - here is my code. This code works when called from onActivate() > and returns the file. > > JAVA > > @Log > StreamResponse onSuccess() { > > try { > > File tmpFile = File.createTempFile(urlFile.getFileName(), null); > BufferedWriter br = new BufferedWriter(new FileWriter(tmpFile)); > br.append("something to test\nAnother line to test"); > br.flush(); > br.close(); > > return new CsvStreamResponse(new > FileInputStream(tmpFile.getAbsolutePath()), "results_file"); > } catch (IOException e) { > e.printStackTrace(); > addError("An Error occured while streaming back the results."); > } > > return null; > } > > public class CsvStreamResponse implements StreamResponse { > private InputStream is; > private String filename; > > public CsvStreamResponse(InputStream is, String filename) { > this.is = is; > this.filename = filename; > } > > public String getContentType() { > return "text/csv"; > } > > public InputStream getStream() throws IOException { > return is; > } > > public void prepareResponse(Response arg0) { > arg0.setHeader("Content-Disposition", "attachment; filename=" + > filename + ".csv"); > //also tried setting content length after this - > arg0.setContentLength(is.available()); > } > } > > > > TML > <form t:type="form" t:id="analysis"> > <t:upload t:id="urlFile" class="marginRight" validate="required"/> > <t:submit class="marginRight white button medium" > value="${message:button.upload}" t:id="upload"/> > </form> > > > > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/redirect-after-post-messes-with-my-StreamResponse-tp4763647p4764159.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Regards Taha Hafeez Siddiqi (tawus) http://tawus.wordpress.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org