I suppose what I am trying to do is impossible, but I just wanted to make sure. I have a link where people can download a file, which is handled by a DownloadAction. Below is the relevant code to download the file, from the execute method. What I want to have happen is that, when the file is downloaded, that they should be forwarded to a page explaining what to do with the downloaded file. In my code here, that would be dealt with by the last line. The problem is that it never actually does get forwarded to the page, presumably because the request is by this point deemed to have been fully dealt with (i.e., the response has been returned). How should I go about doing this?

res.setStatus(res.SC_OK);
res.setContentType("application/octet-stream");
res.setHeader("Content-Disposition", "attachment; filename=" + file.getName());
res.setContentLength((int)file.length());
BufferedOutputStream bos=new BufferedOutputStream(res.getOutputStream());
BufferedInputStream bis=new BufferedInputStream(new FileInputStream(file));
byte[] buf=new byte[32768];//do it in large chunks, it's quicker
int bytesRead;
while((bytesRead=bis.read(buf,0,buf.length))!=-1) {
bos.write(buf,0,bytesRead);
}
bos.close();
bis.close();
saveInfo(downloadForm); //save the details in the database
forward=mapping.findForward("success");


John

=============================================
John Moore     -    Norwich, UK    -    [EMAIL PROTECTED]
=============================================

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to