Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 64110 invoked from network); 2 Aug 2006 12:04:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Aug 2006 12:04:45 -0000 Received: (qmail 77034 invoked by uid 500); 2 Aug 2006 12:04:33 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 76842 invoked by uid 500); 2 Aug 2006 12:04:32 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 76831 invoked by uid 99); 2 Aug 2006 12:04:32 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Aug 2006 05:04:32 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [128.253.83.141] (HELO authusersmtp.mail.cornell.edu) (128.253.83.141) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Aug 2006 05:04:31 -0700 Received: from [128.253.38.244] (defiant.ento.cornell.edu [128.253.38.244]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.13.1/8.12.10) with ESMTP id k72C48Tr017820 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Wed, 2 Aug 2006 08:04:08 -0400 (EDT) Message-ID: <44D094B7.5080700@cornell.edu> Date: Wed, 02 Aug 2006 08:04:07 -0400 From: David Smith User-Agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tomcat Users List Subject: Re: [OT?] Servlet, redirect and progress-monitoring? References: <44D08CD7.3030301@zimmer428.net> In-Reply-To: <44D08CD7.3030301@zimmer428.net> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I suspect what you really have to do is set the PDF generation off into a background thread, storing a reference to the thread in the session. Then return with a refresh every 10 - 15 seconds until the thread finishes. Clean up after the thread so you don't end up with memory leaks and possibly implement a listener to clean-up any abandon threads when the session is destroyed. --David Kristian Rink wrote: >Hi all, > >being aware that this is not a question strictly tomcat-relevant, >lacking a really good mailing-list for discussions closer to the J2EE >background itself, I hope for some input by all the gurus out there. > >I'm into a situation like this: A servlet gathers statistical >information across the data in our DMS, is supposed to make a PDF out of >them and send them back to the client who requested them (PDF is demanded). > >Problem, however, is that sometimes these computations take quite some >time, leaving me with two situations: (a) The browser itself considers >the connection to be "timed out" as the servlet is stuck in doGet() for >a bunch of minutes. (b) The user itself considers the connection to be >"dead" and closes the browser window. Both situations are uncomfortable. > > >By now, my initial idea was something like that, utilizing two servlets: > >- Servlet 1 processes the request and immediately redirects the client >to another servlet while finishing the calculations and creating the PDF >file. > >- Servlet 2 refreshes, say, each 2 seconds, checking whether the file in >question finally has been created and put in place to, then, send this >back to the browser. > > >This, however, doesn't work out as Servlet 1, even though sending the >Redirect, doesn't redirect until leaving doGet(). So, that's not the >solution... > > >My question, now: Is there any "usual" / "best-practise" way of doing >something like that, of presenting people with a "please-stand-by" page >while there is activity goin' on in background? Is there a way of >solving something like this without being in need of JavaScript/AJAX/DWR >or something the like? > >Any hints, even just pointers to good documentation on that issue, are >very much appreciated. > >Thanks and bye, >Kristian > > > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org