If you're trying to do this because of a long-runninig process (like
report generation)...
 
How about starting a new Thread for the processing, and immediately
returning a page that is a 'status' page with meta refresh.  Inside this
status page, you check a few session variables for certain
information/status.
 
The new Thread is passed the session and a timeout value.

Inside the Thread , you'd perform your processing. Hopefully it would
lend itself to the following logic:

if(!done & requestTimer < timeout) {
   // do processing of request
}

inside the loop you could set some session variable ('percent_done') if
you wanted to have the refreshing status page provide feedback. Also set
a 'status' variable, something like "running", "complete", "failed" or
"timeout".
 
The refreshing status page will check the status variable, and on each
refresh, you can forward to any number of pages, depending on the
current state of 'status'. If it's still "running", you'd redisplay the
status page, with perhaps an indication of 'percent_done'.  Alternate to
forwarding, you can use the same status page to report all statii, only
when your status switches from "running" to any other status, have the
JSP remove the meta refresh.




> -----Original Message-----
> From: Neil Aggarwal [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, September 23, 2003 11:38 AM
> To: 'Tomcat Users List'
> Subject: RE: Possible to terminate a long request?
> 
> 
> Daniel:
> 
> I appreciate your suggestion, but that wont terminate the 
> request. It will just mean the user's session wont be aroung 
> when they make their next request.
> 
> Thanks,
>       Neil
> 
> 
> --
> Neil Aggarwal, JAMM Consulting, (972)612-6056, 
> www.JAMMConsulting.com FREE! Valuable info on how your 
> business can reduce operating costs by 
> 17% or more in 6 months or less! => 
> http://newsletter.JAMMConsulting.com
> 
> > -----Original Message-----
> > From: King,Daniel [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, September 23, 2003 11:27 AM
> > To: Tomcat Users List
> > Subject: RE: Possible to terminate a long request?
> > 
> > 
> > What about setting a session timeout value in the
> > application's web.xml (value below is minutes)?
> >  
> > <session-config>
> >   <session-timeout>2</session-timeout>
> > </session-config>
> >  
> > I have not actually used the elements above-- I just looked
> > it up in a book, Tomcat by Brittain and Darwin, published by 
> > O'Reilly.  I have used session time-outs a lot in WebLogic.
> > 
> >     -----Original Message----- 
> >     From: Neil Aggarwal [mailto:[EMAIL PROTECTED] 
> >     Sent: Tue 9/23/2003 10:20 AM 
> >     To: 'Tomcat-User' 
> >     Cc: 
> >     Subject: Possible to terminate a long request?
> >     
> >     
> > 
> >     Hello:
> >     
> >     Is there a way to terminate a request that takes more than
> >     a given amount of time?
> >     
> >     I know I can use the java.util.Timer class to get called back
> >     at a given point in the future, but how can I terminate the
> >     request and put up an error page to the user?
> >     
> >     Any suggestions will be helpful.
> >     
> >     Thanks,
> >             Neil
> >     
> >     
> >     --
> >     Neil Aggarwal, JAMM Consulting, (972)612-6056,
> www.JAMMConsulting.com
>       FREE! Valuable info on how your business can reduce 
> operating costs by
>       17% or more in 6 months or less! => 
> http://newsletter.JAMMConsulting.com
>       
>       
>       
> 
> ---------------------------------------------------------------------
>       To unsubscribe, e-mail: 
> [EMAIL PROTECTED]
>       For additional commands, e-mail: 
> [EMAIL PROTECTED]
>       
>       
>       
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to