I have a JSP that gathers form data and submits it to a perl program in a CGI bin. This perl program calls a server side executable and does some processing that can take a long time at times. My problem is that if the request requires a lenthy processing time the JSP page times out waiting for the response from the Perl Program. Any suggestions about how to force the JSP to wait?
What is timing out is your browser and unfortunately, although possible, it is not plausible to change the timeout settings on it. One sloppy 'workaround' that I would suggest is to create a thread and kick it off in the servlet and redirect to a 'waiting' page. In the thread object, store a boolean that will be set to true when the thread has finished executing. After kicking this off, store it into the session. Set your 'waiting' page to refresh every minute or so. When it does have it hit the servlet and pull the Thread object out of the session and check the value of the boolean. If it's true, send the data back to the user, otherwise redirect back to the 'waiting' page. As I said, this is sloppy but is the best I can offer at 10:36 on a Friday night.
No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
A separate helper object that runs its own Thread is really the best solution. After you create it and start it running, just put it in the session. Make sure you provide some way for it to communicate status. One great advantage of putting all the work in a helper object is that you can test it off-line - without the additional confusion of JSP. Bill