• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Fully asynchronous progressbar

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Saloon Keeper
Posts: 25830
184
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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~
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic