aspose file tools*
The moose likes JSP and the fly likes Fully asynchronous progressbar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Fully asynchronous progressbar" Watch "Fully asynchronous progressbar" New topic
Author

Fully asynchronous progressbar

N Deshmukh
Greenhorn

Joined: Sep 14, 2002
Posts: 4
Hi,
How do we implement a fully asychronus progress bar?
I have a long task running on server and i want to report status to html client.
If we have say 100 iterations to be completed , then on completion of each iteration the status should be reported to the client, without client requesting for progress.
Thanks,
Nivedeeta
Jeya Balaji
Ranch Hand

Joined: Jan 02, 2003
Posts: 40
hmmm, I had an idea to develop a generic code to do this ... waiting for time.
The skeleton of my idea is :
A bean, say ProgressBean, with methods like

have a progressDisplay.jsp something like :


You may place this jsp inside a frame set (like 1 along with 5 or 6 frames) so that this jsp will occupy a small portion in the browser window and the refresh will be less noticible.
ProgressBean might implement an interface which has those methods. This might end up as a generic code.
If u happen to get a generic code, please pass it to me (j_balaji00@yahoo.com)
Regards,
Balaji


Regards, Balaji
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Originally posted by N Deshmukh:
If we have say 100 iterations to be completed , then on completion of each iteration the status should be reported to the client, without client requesting for progress.

It may be possible, but browsers work on HTTP. HTTP requires a request and a response, and this doesn't sound like HTTP at all.
I can think of ways of making it work, but the real danger you face is that it will only work in an unstable manner on a single browser type. This is a real danger when you try to do 'windows application' type operations in a browser.
Having said that, you can have an image that displays the progress. This image is generated by a servlet on the server, and you just keep refreshing the image. The problem here is that you won't be able to tell when the operation completes.
I still prefer having a very light page that displays the results and refreshes every few seconds. This solution is based on HTTP.
Dave
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16142
    
  21

Yup. HTTP is a Synchronous protocol, so by definition, you can't do Asynchronous traffic using it.
I can't say I *like* the "page-refresh" approach, but it's the only way you can fake asynchronous messaging other than by using an applet. And even an applet isn't going to do asynchronous comms over the HTTP channel. You could use some other networking mechanism with an applet, but only if you're positive no firewalls will block that channel.
Then there's the problem that Microsoft has thoughtfully distributed versions of Windows without Java in them, so you're not even guaranteed an applet will work~


Customer surveys are for companies who didn't pay proper attention to begin with.
Michael Arndt
Greenhorn

Joined: Feb 25, 2003
Posts: 21
Well, I guess Flash might fit your needs. Use a parameter passed to the flash film that gives you access to the actual progress status on the server.
The flash plugin ist available for almost every browser. And you might provide the refresh-strategy as a fallback.
Regards, Michael
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Fully asynchronous progressbar