Solved

How do I implement a Server side data push in a java spring jsf2 web project

Posted on 2012-03-28
9
370 Views
Last Modified: 2014-09-07
How do I implement a server side data push in a java spring jsf2 dynamic web project with jquery functions working on front-end web page.
I want to get server side updates without a user interaction into the facelets xhtml front end page which should display cell by cell updates to a html table.
Expectation is a complete working code example.
0
Comment
Question by:Swarnajith
  • 3
  • 2
  • 2
9 Comments
 
LVL 51

Accepted Solution

by:
Ted Bouskill earned 300 total points
ID: 37782499
You cannot push from a web server.  The HTTP protocol does not support it.  You have to write JavaScript or a Java applet to poll the server for updates.

As soon as a page is loaded by the browser it disconnects from the web server.  It's a common misconception that the browser stays connected to the server like typical client/server application.
0
 

Author Comment

by:Swarnajith
ID: 37782568
I can't exactly say you are correct or wrong. But I have used IcePush in order to do this and it actually brings updates from server to front-end as well and it updates whole java data Lists rather than html table individual cells. The problem I'm facing with that technology is as an when a server update happens my User Interface's JQuery functions malfunction and the JQuery UI styles vanishes. Because of that i'm searching for any other ways in doing this.
0
 
LVL 51

Assisted Solution

by:Ted Bouskill
Ted Bouskill earned 300 total points
ID: 37787676
IcePush is AJAX which is actually polling JavaScript exactly as I stated.  Read this quote from their website:

"The ICEpush Core implements the asynchronous notification mechanism using long polling over HTTP."

I can 100% guarantee that the browser client can only pull from the server.  They are simulating a push using polling.
0
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 200 total points
ID: 37790734
with html5 + websockets you can do a server push, see RFC 6455 or http://dev.w3.org/html5/eventsource/
IIRC vrowser support is lazy and the technology has a lot of security implications
0
 

Author Comment

by:Swarnajith
ID: 37790753
But I cannot use HTML 5 because its not compatible in every browser so far.

Can you give me an example of how to do a jquery ajax poll with jsf. It'll be more helpfull.
Thanks for the help so far.
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 200 total points
ID: 37790773
> Can you give me an example of how to do a jquery ajax poll with jsf.
will be hard as such a simple XHR call first needs to know what you've implemented server-side and then your jequery needs to know how and where the server response should be displayed
I assume it's better you consult your prefered search engine and modify the code snippets you'll find for your desires
0
 
LVL 51

Assisted Solution

by:Ted Bouskill
Ted Bouskill earned 300 total points
ID: 37791369
Guys I just wanted to comment that technically if you dig deep enough it isn't a true *PUSH* in HTML5.  The client doesn't sit with an open port waiting for the server to connect to push an event to it.  Deep down it's still the browser polling to server to see if there is a queued event waiting to be processed.

The server doesn't maintain a list of connected client IP's that it then processes in a queue to send messages to each connected browser.  That overhead would be too much for the server and then someone could create a new type of DoS attack where they added a load to the push queue to kill server performance.

Nor does the clients maintain a permanent socket connection which would once again be a candidate to overload the server.  The basic HTTP protocol still is the same.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to implement Singleton Design Pattern in Java.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question