Solved

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

Posted on 2012-03-28
9
340 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:
tedbilly earned 300 total points
Comment Utility
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
Comment Utility
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:tedbilly
tedbilly earned 300 total points
Comment Utility
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 to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 200 total points
Comment Utility
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
Comment Utility
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
Comment Utility
> 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:tedbilly
tedbilly earned 300 total points
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

762 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now