File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes setting connectionTimeout in Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "setting connectionTimeout in Tomcat" Watch "setting connectionTimeout in Tomcat" New topic

setting connectionTimeout in Tomcat

Prasad Darsi

Joined: Sep 26, 2004
Posts: 16
I am using tomcat 5.5, apache 2 and jk2 to connect apache to tomcat.

One of the jsp page that I am accessing in my application is taking about 2 hours to complete the
process (because it is running an oracle procedure which processes an entire month's data).
When I am try to access the page, it is showing the progress in status bar of the browser exactly for an hour and then showing
the message 'The page cannot be displayed' after that period.

I tried setting the connectionTimeout attribute in tomcat's server.xml file to "0" but it didn't work.
Later I read on the net that one has to set it to "-1" to disable the connectionTimeout. But this also didn't work.

Is there any other way to achieve this, so that connection remains open atleast for 2 hours?

Thanks in advance..
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

There's a limit to how much you can control a browser.

For long running processes, most people use a polling page or frame.

  • Kick off the process
  • Immediately return the user to a status page.
  • Have the status page refresh periodically using a meta-refresh tag or JS.
  • When it refreshes have it check the status of the process via a variable in session or application scope or a database call.
  • Once the long running process is done, have it update whatever it is you're checking.
  • When the polling status page sees that the process is complete bring the user to the 'complete' page

  • This also helps the user diffrentiate between a successful kickoff of the process and a hung browser.

    There are variations using frames that allow the user to keep working in your app while this is going on in the background. When the process is done, you can trigger a javascript popup message from the hidden frame.
    [ January 20, 2005: Message edited by: Ben Souther ]

    Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
    I agree. Here's the link:
    subject: setting connectionTimeout in Tomcat
    It's not a secret anymore!