voyent
Difference between PushRenderer.addCurrentSession() and PushRenderer.addCurrentView()  XML
Forum Index -> ICEpush General
Author Message
ivanhoe

Joined: 17/Aug/2012 07:25:43
Messages: 17
Offline


Hey everyone,
I'm having a new issue. What exactly is the difference between "PushRenderer.addCurrentSession()" and "PushRenderer.addCurrentView()"?
If I understand the documentation right, "addCurrentSession()" should prepare all Portlets of all Pages in the specified group to be rendered on request. "addCurrentView()" on the other hand only prepares the portlets on the ACTIVE page to be rendered. However, this is not the case.
I have a setup of 3 Portlets, all in the same group on one page plus one of the portlets, in the same group, on another page. I opened two browsers (Chrom & Firefox) and both pages and then triggered the push event. Tada all pages always rerender. But I only want the Portlets of the page on which the event is triggered to render.
Can anybody point me to a solution?
ivanhoe

Joined: 17/Aug/2012 07:25:43
Messages: 17
Offline


Noone hast a Hint or something?
I realy can't figure out a difference between the two methods. Regardless of what method I use / what scope my Beans have. Every time I call PushRenderer.render("MYGROUP"); every single Portlet gets updated.
Is this a problem with the liferay Server? Is there only a difference in a non-portal environment?
deryk.sinotte


Joined: 26/Oct/2004 00:00:00
Messages: 1008
Offline


Can you provide some markup and code or a small test case to help clarify what you are trying to do?

It sounds from your description that they are all in the "same group". Whenever a render is triggered for that group, all views that were added to that group name would get a push update.

In other words, are you using different group names for the portlets on the different pages?

Deryk Sinotte
Team Lead
ICEsoft Technologies, Inc.
ivanhoe

Joined: 17/Aug/2012 07:25:43
Messages: 17
Offline


Firstly, thanks for the reply.

No I'm not using different groups.
But if with every trigger of the render method all views for that group are getting a push update, why are there those two functions?

I thought the addCurrentSession() method only adds the views of the one client (because he has a unique session that is not shared with other clients) so that a push only updates his personal view.
addCurrentView() on the other hands adds the current view for all clients thus a push updates the view of all clients.

The problem why I need to have those two cases is, my company wants to be able to do both. We want to be able to update alle pages of all clients.
Little example (product management):
Client A starts to edit a product. Thus it needs to be locked for all other clients so that not two persons can edit the same product (to avoid loss of data).
But if Client B searches for something in the productlist and gets an update with the shortened list we don't want that the same result is displayed for Client C who searched for something a minute ago.

Yeah I hope my point is clearer now.
Is this management only possible with different group names?
Like the groups "GLOBAL_UPDATE" for global updates (go figure) and "SID_HAFJH234243" [session id of the user] for user specific updates?
deryk.sinotte


Joined: 26/Oct/2004 00:00:00
Messages: 1008
Offline


The use of groups (via different group names) is the way to do what you want to do. All views in a given group will get an update when a push is triggered for that group. To divide up different views, assign them different group names.

The two APIs for adding to views to the group basically do the same thing but with a different granularity. The method addCurrentView simply adds the single current view to the group where addCurrentSession would add *all* the views for that user session to the group. This allows you to control the granularity of the push at a different level as you might not want all the views to participate in push updates.

Deryk Sinotte
Team Lead
ICEsoft Technologies, Inc.
ivanhoe

Joined: 17/Aug/2012 07:25:43
Messages: 17
Offline


Thanks for the clarification!
ivanhoe

Joined: 17/Aug/2012 07:25:43
Messages: 17
Offline


Hey one more quick question.
Could you please specify what you exactly mean when you say "view"?
If I understood it correctly a view is one browser tab. If I open the same page in another tab it is technically a different view.
Am I correct? And if so, those two methods still don't function correclty for me :p
Regardless of what I do always all pages get the push and rendered ...
deryk.sinotte


Joined: 26/Oct/2004 00:00:00
Messages: 1008
Offline


A view from JSF's perspective can typically be per browser tab or window but it's not always the case. For example, portlets can put multiple views on the same page. Framesets would also be different.

However, in a typical web app, it should be a view per tab and if you're adding a specific view to the render group then I would think that only that view would get the push updates.

Can you provide a simple test case or some markup and bean code to illustrate the problem?

Deryk Sinotte
Team Lead
ICEsoft Technologies, Inc.
 
Forum Index -> ICEpush General
Go to:   
Powered by JForum 2.1.7ice © JForum Team