开发者

Adding Progress Bar during RPC

I wan开发者_StackOverflow社区t to add a progress bar during a gwt-rpc call which shows the percentage of the task completed.Anyone who can help me with a piece of code for the same?

Also I load videos into my client side from the war directory and they take a while.Therefore if I try to play them sometimes the browser goes unresponsive(probably because entire part hasnt loaded) .Is there a way to determine (and hence show the user) when the videos are completely loaded?


There's a progress bar widget in the gwt-incubator project. However, most of your GWT-RPC calls should be really fast, so I can't imagine the progress bar will have time to appear. Furthermore, there's no way that I know of to get the progress of your GWT-RPC call, you'd have to manually code that feature on the server side.

For example, if you're running a long job, you could create another GWT-RPC call that calls every 30 seconds to find out the status of the running job and updates the progress bar accordingly.

However, for regular GWT-RPC calls, you're best bet is some kind of "loading..." notification. It shouldn't be around for long and is easy to code.

As for your second question, that's not the best way to display video. When you just dump the video file to the user, the user will be required to have that video codec on hand and will be forced to wait until the video has fully downloaded. A better way to display video is either:

  1. Some kind of Flash player that'll stream the video.
  2. An HTML 5 tag that'll only work in modern browsers.

Hope that helps.


If you have always just one RPC call for each of your actions, it is not a good idea to use progress bar. Because you have to do extra effort in server side for this which will be far more complex than what actually you want to do.

You can use progress bar, if you have more than one RPC on one action. For example if you have 4 RPC calls, you can add 25% to progress bar after each one is completed. This will also allow you to lock the screen after all calls will be successfully finished and specifically know which RPC call is failed from client side according to current percentage and related description of the percentage.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜