views:

248

answers:

6

I am in a situation where I would like to implement Ajax Push in a Java based web app to update things like counts of item in stock on the web page as they change without any interaction from the user. I understand that the technology needed to do this is called Ajax Push. I also have some experience with JSF 2.0, and this is preferred but not required.

First we need a demo showing this in about a couple of weeks, but if the demo is accepted we will have sufficient time to do it right.

I've looked around and found that apparently Icefaces do this very well, and I will look into it. I would just like to hear if there happens to exist others which might even be better for us to use?

Please, no "these are the top three hits from Google" answers. I'd like to hear opinions based on experiences.

+2  A: 

I don't know if it is better since I don't do IceFaces, but PrimeFaces has a <p:push> component as well. It makes use of Atmosphere under the hoods to be as much as possible appserver-independent, which is in turn already pretty awesome. It abstracts all the appserver-specific details away. Also see this article about Servlet 3.0 vs. Atmosphere:

Atmosphere always auto-detected the best asynchronous API when you deploy your application. It always try first to look up the 3.0 Async API. If it fails, it will try to find WebServer's native API like Grizzly Comet (GlassFish), CometProcessor (Tomcat), Continuation (Jetty), HttpEventServlet (JBossWeb), AsyncServlet (WebLogic), Google App Engine (Google). Finally, it will fallback to use a blocking I/O Thread to emulate support for asynchronous events.

How to get it all to work is in detail explained in chapter 6 of PrimeFaces User Guide (PDF) in flavor of a chat application as it is presented in the <p:push> showcase page.

BalusC
Would you recommend it?
Thorbjørn Ravn Andersen
It looks good on paper, but as @Gabor in the other answer said, it's tougher to get it to work. Actually, after this answer I decided to play somewhat with it. It indeed doesn't work very well with current Atmosphere 0.6.x releases. You would need 0.5.x and then at least 0.5.1. The PF guys should catch it up in the next PF releases. In general, I can recommend PF as component library. But this would be a bit subjective since I haven't played extensively with IceFaces. The only experience I had was bad because I couldn't get it to run on GF v3 and the fix requires the EE version (not free).
BalusC
+1  A: 

We have tried both Icefaces (in JSF 1.2 mode) and Atmosphere/Comet with Primefaces.

Icefaces push worked brilliantly out of the box.

We couldn't get Atmosphere to work (in Primefaces), but this could be because we tried it with the latest (0.6) version, and Primefaces doesn't support it yet - so now we are waiting for an updated version (it is promised that it will be the next big feature after p:dataTable has been rewritten). In our case the push was not a critical element in the demo and we could easily use polling instead of a real push solution.

Icepush was very easy to get up and running, while Atmosphere is not very well documented (IMHO), and requires a bunch of jars and configurations. It is not for beginners for sure.

So, if ajax:push is a key part of your demo I'd suggest that you stay with JSF 1.2 and Icefaces. At least until the demo is done and the customer is happy - you can still take you time with the Atmosphere configuration after that ;-)

Gabor Kulcsar
Chosen for saying "this works"
Thorbjørn Ravn Andersen
+2  A: 

You can now use Ajax Push outside of ICEfaces. Checkout http://www.icepush.org/. There are client adapters for JSP, Spring MVC, Wicket, GWT, jQuery, prototype, and Grails.

Philip Breau
+1  A: 

I think ICEfaces is the best solution for AJAX PUSH, they pioneered it, and in my opinion they have the best implementation.

Calin Martinconi
A: 

ICEfaces is definitely your best best for the short-term demo requirements, as well as your longer-term "doing it right" goals.

To begin with, ICEfaces provides the most natural model for developing push applications. You think in simple terms of server-side triggers causing state changes in your application. ICEfaces and JSF do the rest, affecting seamless rendering of the new state. No messy push tag markup where you have to declare precisely how the presentation changes with each push event. If you know JSF, adding push to an application is dead simple with ICEfaces. Get your basic JSF application working first, and then add the necessary push logic to your server-side code. No other changes required.

Longer-term you should know that ICEfaces provides all the deployment technology you will need for enterprise-strength deployments. Enterprise Push Server is central to this as it provides complete push connection management in clustered environments (see: EPS). ICEfaces Ajax Push is operating in a wide spectrum of production environments in many Fortune 500 enterprises, so you can rest assured it will scale to your demands. Additionally, professional customer support is available. These are all be key characteristics that will help you sell the substance behind your demo.

Nothing else in the marketplace compares, and look forward to ICEfaces 2.0 which is JSF 2.0 compliant, and brings next-generation Ajax Push capabilities. Its available in Beta now.

Steve Maryka
Is this based on personal experience or a sales pitch?
Thorbjørn Ravn Andersen
A: 

Primefaces looks promising but the push functionality doesnt work with their latest release. With Icefaces 2 beta, push works OOTB.

Luke