Which good ways exists to reload front page by server every time that new article placed by editor in front page for (news popular website like fox.com, cnn.com)?
Thanks
Which good ways exists to reload front page by server every time that new article placed by editor in front page for (news popular website like fox.com, cnn.com)?
Thanks
You are looking for some asynchronous client/server communication.
GWT and GWT-RPC:
Since you are on Java, I recommend you have a look at GWT, will simplify your "AJAX" work with its GWT-RPC. In GWT you use Java language on both the server-side and the client-side (compiled to JavaScript), and will handle all the implementation details on the asynchronous communication under the hood.
To do the polling here, you can have a timer on the client-side (on the webpage) that will call a method that you have written on the server to give the data, can either be a String
that represents some news, or even encapsulate it into a News
class, with title, summary, body, and timestamp etc. The News
class will then have to be in a shared (between client and server) Java package, so the implementation can be used on both sides without having you duplicating code.
GWT Comet:
This gwt-comet library provides an efficient Comet implementation for GWT.
The library implements Comet by streaming messages over long lived HTTP requests to minimise latency and bandwidth requirements and maximise the throughput. This is opposed to many other implementations which use polling or long polling techniques.