aspose file tools*
The moose likes Struts and the fly likes Struts forwarding to a 404 page in case of a long running transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts forwarding to a 404 page in case of a long running transaction" Watch "Struts forwarding to a 404 page in case of a long running transaction" New topic
Author

Struts forwarding to a 404 page in case of a long running transaction

Sarath Jonnalagadda
Greenhorn

Joined: Sep 19, 2008
Posts: 1
Hi,
I have a problem. Currently we have an application which uploads data to a SFTP server. Depending on the data getting uploaded, the application can complete in few mint's or it can be a long running transaction. At, the end of the operation we will get a summary sheet page.

We receive the summary sheet, if the transaction is a short lived one. But in case of a long running transaction we get a 404 page instead of the summary page. We even tried to increase the session timeout to 20Hrs.. But no help.

It is an immediate requirement.
Thanks in Advance.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

Welcome to the JavaRanch.

Originally posted by Sarath Jonnalagadda:
It is an immediate requirement.


First, Ease Up. Everyone's post here is "immediate", at least to them.
Next, it's a bad idea to use web server threads to perform long-running tasks. Web servers are designed to handle multiple short-lived HTTP communications, not hours-long batch jobs. Even if you make the session timeout huge, you still have to deal with other issues, like TCP/IP socket timeouts, firewall issues, browser timeouts and so on.
The typical solution in this case is to hand the long-running task off to another server designed for this task and let it run asynchronously. The HTTP request returns immediately. Either the user can be informed of the task completion with an email that contains a link to the results, or a waiting page can be displayed that refreshes at an interval. A task number stored in the session can be used to query the asynchronous task status.
[ September 19, 2008: Message edited by: Joe Ess ]

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
John Woo
Greenhorn

Joined: Jul 29, 2008
Posts: 8
Yes, for such a long transaction, it is better to use asynchronous approach. You can use message queues to implement. Web applications are for synchronous transactions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts forwarding to a 404 page in case of a long running transaction