Solved

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

Posted on 2012-03-28
9
390 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
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

Increase Agility with Enabled Toolchains

Connect your existing build, deployment, management, monitoring, and collaboration platforms. From Puppet to Chef, HipChat to Slack, ServiceNow to JIRA, Splunk to New Relic and beyond, hand off data between systems to engage the right people.

Connect with xMatters.

Question has a verified solution.

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

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to implement Singleton Design Pattern in Java.

695 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