Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 4149 invoked from network); 11 May 2004 17:02:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 11 May 2004 17:02:52 -0000 Received: (qmail 67046 invoked by uid 500); 11 May 2004 17:03:43 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 66979 invoked by uid 500); 11 May 2004 17:03:42 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 66958 invoked by uid 98); 11 May 2004 17:03:42 -0000 Received: from john@jmsd.co.uk by hermes.apache.org by uid 82 with qmail-scanner-1.20 (clamuko: 0.70. Clear:RC:0(195.112.4.54):. Processed in 0.087174 secs); 11 May 2004 17:03:42 -0000 X-Qmail-Scanner-Mail-From: john@jmsd.co.uk via hermes.apache.org X-Qmail-Scanner: 1.20 (Clear:RC:0(195.112.4.54):. Processed in 0.087174 secs) Received: from unknown (HELO smtp.nildram.co.uk) (195.112.4.54) by hermes.apache.org with SMTP; 11 May 2004 17:03:42 -0000 Received: from jmsd.co.uk (jonmor.gotadsl.co.uk [213.208.123.172]) by smtp.nildram.co.uk (Postfix) with ESMTP id CF1AF24CF29 for ; Tue, 11 May 2004 18:02:12 +0100 (BST) Message-ID: <40A106CC.90004@jmsd.co.uk> Date: Tue, 11 May 2004 18:01:00 +0100 From: John Moore Reply-To: john@jmsd.co.uk User-Agent: Mozilla Thunderbird 0.5 (X11/20040229) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Struts Mailing List Subject: Forward after returning content? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: hermes.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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 - john@jmsd.co.uk ============================================= --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org