Pascal Kesseli
Pascal Kesseli

Reputation: 1670

Observer pattern with JSF/PrimeFaces

Is there a recommended way of implementing the Observer pattern in JSF, i.e. forcing a UI update from the Java bean?

I've taken a look at PrimePush, but none of their ShowCase examples seem to work with my browsers (e.g. FF 19.0), which is why I shied away from it.

I am currently using a PrimeFaces poll to update the respective components in a regular interval. I was thinking about reducing the poll’s interval to "1" and having its action method block until the server is ready to push. Is that a good idea or will such long-running requests be canceled at some point?

<p:poll interval="15" listener="#{fileBucket.keepAlive}" update=":download:files :expiryDateValue" oncomplete="updatePageIsValidForValue();" />

Upvotes: 0

Views: 1367

Answers (1)

mrembisz
mrembisz

Reputation: 12880

Blocking action in poll would basicaly be a hand-crafted push and I would advise against it, you will most likely run into many problems. Polling is safer and more portable but if this is not enough you should try one of the existing push implementations like PrimePush.

Upvotes: 1

Related Questions