Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 78478 invoked from network); 1 Nov 2004 20:27:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 1 Nov 2004 20:27:07 -0000 Received: (qmail 42458 invoked by uid 500); 1 Nov 2004 20:26:38 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 42275 invoked by uid 500); 1 Nov 2004 20:26:37 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 42262 invoked by uid 99); 1 Nov 2004 20:26:37 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [207.155.252.75] (HELO valiant.xo.com) (207.155.252.75) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 01 Nov 2004 12:26:36 -0800 Received: from [192.168.0.103] (67.107.112.238.ptr.us.xo.net [67.107.112.238]) by valiant.xo.com id PAA11390; Mon, 1 Nov 2004 15:26:34 -0500 (EST) [ConcentricHost SMTP Relay 1.17] Errors-To: Subject: RE: Response and file downloads From: Ben Souther To: Tomcat Users List In-Reply-To: <86901B49BB9A9F409862F5520B389CED133160@tmc2ksbs.tmc.technical-magic.com> References: <86901B49BB9A9F409862F5520B389CED133160@tmc2ksbs.tmc.technical-magic.com> Content-Type: text/plain Organization: F.W. Davison & Co, Inc. Message-Id: <1099340793.25315.16.camel@bsouther> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Mon, 01 Nov 2004 15:26:33 -0500 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N As the other poster correctly stated HTTP is a single request/response protocol -- emphasis on "protocol". Once you send the headers and response to a browser from a server, you can't send another one. This is not a Tomcat issue. On Mon, 2004-11-01 at 15:17, Luc Foisy wrote: > I know there is only a single response, thats why I want to create a new one :) > > I don't even want to get into opening other windows nor do I want to rely on javascript for required operation. > > I am not sure what you are refering to as atypical or robustness... > > How do other sites generate files on the fly (take it out of a database, or a report just run), on form submit, and send them down the line and not run into this problem? > > I see many people posting many places on the net that they are using the response to send a file, a lot of them are getting this IllegalState, but I never really found a followup solution that really fit my needs. > > Why would the possibility exist to push a file through the response if it leaves you with the ability to go nowhere after? > > (not really questions possed to you Justin, just hoping to keep it alive) > > -----Original Message----- > From: Justin Ruthenbeck [mailto:justinr@nextengine.com] > Sent: Monday, November 01, 2004 2:56 PM > To: Tomcat Users List > Subject: Re: Response and file downloads > > > > Luc, > > At 11:42 AM 11/1/2004, you wrote: > >I am having a wee problem with using the response. > > > >I have a form on a page, with a submit button to download a file. That > >file is being pulled from a database and pushed to the response. > >The problem I am having, I just used that response to submit the page, > >so I am getting and IllegalStateException, even though it is still > >pushing the file to the browswer > >I also want to be able to send a redirect after the file is downloaded > >(so I can refresh the page so the form submit page is regenerated, since > >we are using a string to determine unique submits are only coming from > >the pages we generated, and not the browser address bar) > > > >Can we get a new response from the session variable (the one available > >to jsp writing) to send the file, then get another new response to > >perform a redirect.... > >Basically I want to be able to do something like > > > >the form submits, and passes to the applications perform methods through > >the jsp catching the submit > >response = new Response > >response.sendFile > >response = new Response > >response.sendRedirect > >(yes I know those are not actual methods and classes, just trying to > >explain what I want) > > Your understanding of how, exactly, the http protocol works is > incorrect. Because it is a (single) request, (single) response protocol, > what you're asking for cannot be done. > > It seems like what you want is for a user to fill out a form, click > submit, then be presented with a new, fresh, form again ... with the file > download on the side. If you have determined that you absolutely want > this behavior (it's atypical, so doing it won't be particularly robust), > consider programmatically opening another browser window on form submit > from which the download will happen ... and reload your form in your > "main" browser window. This will, of course, subject you to any > headaches associated with javascipt window opening. > > justin > > > > ______________________________________________ > Justin Ruthenbeck > Lead Software Engineer, NextEngine Inc. > justinr - AT - nextengine DOT com > Confidential. See: > http://www.nextengine.com/confidentiality.php > ______________________________________________ > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org