Tapestry: Redirect-after-post messing my StreamResponse in onSuccess() -
After uploading the file to a user, I read the file, processed it and received a CSV (stream response) Sent back I am facing problems getting back the results. In the firebug I see the post response as '302 temporarily taken' and my page does not show the streaming file again, it loads again I think tapestry redirect-post-post send me the file back streaming Instead of reloading the page. Is this happening? How can it be fixed?
This is my code:
(only by cutting the body)
@log stream Response onsut () throws IOException {file tmpFile = File.createTempFile (urlFile.getFileName (), blank); BufferedWriter br = new BufferedWriter (new FileWriter (tmpFile)); Br.append ("The second line to test" is something to test) ;; Br.flush (); Br.close (); New CsvStreamResponse (new FileInputStream (tmpFile.getAbsolutePath ()), "results_file" Return;} public class implements CsvStreamResponse StreamResponse {private InputStream; private String filename; public CsvStreamResponse (the InputStream, string filename) is {this.is = ; This.filename = filename;} public string getContentType () {return "text / csv";} public input stream GetStream () that throws IOException {return;} public void prepare Rispons (North response) {response.setHeader ( "content -Web "," Attachment; File No " In = "+ filename +" .csv ");}} My TML
& lt; Form t: type = "form" t: id = "analysis" & gt; & lt; t: upload t: id = "urlFile" class = "margin right" valid = "required" /> : Submit class = "marginRight white button medium" value = "$ {message: button. Upload}" t: id = "upload" /> < / Div>
I have never done that, from where you get a stream from
Comments
Post a Comment