Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Server-push implementations (Reverse AJAX, DWR, Pushlets, Comet, etc..)

843841Apr 30 2007 — edited Jun 1 2007
Hi !

I'm sorry if I'm posting it in the wrong section, but I really did not find anything better ... after all my post is about servet too, even though the problem is not with the servlet :)

I have been reading a lot of stuff lately on the subject of "Reverse AJAX". By some coincidence, the first real webapp which I want to make relies on server pushes, that is, the data on the server constantly changes and I want to be able to update the client's browsers with latest info from the server.

Now what I found out is that I need "active" server-push, to be even more preceise, I'm looking for an implementation of the Comet technique and not Polling or Piggyback, though I guess polling would do the trick, but then again, I can do this very well without server-pushes - AJAX + polling = emulation of server pushes, but I don't want that, which is why I want to implement the Comet technique.

The problem:

There are very few articles which describe what I need, and some of those which are relatively good have sample code which doesn't work for me. Moreover, some samples are too simple and I wouldn't know how to apply that code in my situation.

My problem:

1) My webapp in itself is a servlet with a running thread which polls several other (for instance X) servers;
2) For each of the X servers it creates an object which contains the state of those servers. The state of the servers often changes. Each such instance of a data object is about 1200 bytes.
3) I have Y number of clients which should connect to my servlet and without refreshing the page must get up to date information about each of the X servers.
4) The information about the state of each of the X servers is displayed as a row in an HTML table.
5) So that means that even the number of rows in the table may vary - be dynamic - for example, when one of the X servers goes down, or up.
6) ideally, my servlet would pass/push the Data[] array with info about each server to all monitoring browsers, and the client side HTML/javascript/whatever would re-render the HTML page using DOM or something.

Thing is I know what want, but I am not sure which of the available Comet implementations will do better what I need. The best example of what I need I found here:

http://upl.codeq.info/ajaxkurs/stocks.html

(roll over the table to initialize stocks)

This example is alsmost a perfect example of what I need, the only thing it does not do is that it does not change the number of rows. But I'm sure this can be done as this example does it:
http://upl.codeq.info/ajaxkurs/persontable.html

and all of this is implemented using DWR. Needless to say, all the sample code does not work for me and I don't know why. I've added some comments here:
http://today.java.net/pub/a/today/2007/03/22/developing-applications-using-reverse-ajax.html

Some ideas? Advice? Architectural advice? I'm mainly worried about how would I send the array of data objects ... should I send the objects or should I generate the new table on the server side and push it as javascript ... I'm a bit lost honestly.

I would really appreciate some help,
Regards,
Oleg
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 29 2007
Added on Apr 30 2007
2 comments
347 views