No, portlet session are portlet-local. There is no standard way to do inter-portlet communication in the portlet spec, but most products provide some proprietary APIs.
It is something I need to look into more closely with Roy.
It that true for Seam applications? I thought that Seam was a bit close to JBoss Portal. I have read different places that JBoss Portal supports interportel communication if they are build into the same portlet application.
"Any object stored in the session using the APPLICATION_SCOPE is available to any other portlet that belongs to the same portlet application and that handles a request identified as being part of the same session."
Doesn't seam support this? Then my question is how I can access the PortletSession from Seam. Is that possible?
Thanks again! :)
Sorry for answering myself!
Now I've found a way to solve my problem. It works when I use the PortletSession and the APPLICATION_SCOPE. Now I have also found the way to get the PortletSession from Seam:
I have a roadmap item to look at integrating JBoss Portal's IPC stuff with Seam. But I have not done any of the research I need to do to understand this stuff properly yet.
Yes in Portal per the spec there are 2 scopes of session, portlet and application scope.
Currently in Seam we only support Portlet scope.
IPC is different, it doesn't have any context, it just trigger events that other portlets are listening to.
Originally, I had actually planned a PORTLET_SESSION scope distinct from the SESSION scope. But then from Roy I got the impression that use of the global session scope was considered a Bad Thing. Perhaps we need to revisit that discussion.
On the IPC stuff, it is an event architecture, and so it is ripe for abstraction by Seam.
SESSION scope is misused to do IPC in a standard way (It's the only way that would work on any JSR168 portlet container).
There is no real logic for application session scope.
Well, I guess I'm just not quite convinced that this is always a misuse...
I thought I'd seen a portlet scope, that is PortletSession.APPLICATION_SCOPE reservation in earlier seam documentations and wondered what has happened when the time came for it to be used.
I'd rather be "misusing" session with Seam annotations than doing it "by-the-book" without Seam support. IPC of JBoss Portal is quite compact solution - one of the best in my opinion - in it's simplicity but not a solution that can be used with other portal containers. Also there is that one-to-one relationship between portlets restriction.
I hope that this scope will come as part of Seam although it's directly supported by JSF and causes tight coupling with portlet api since I don't think new contexts below conversation can plugged in just like that allowing them to be truly optional.
Mimicking IPC with Seams remote JMS capability seems to be an option, but I see that it may change radically in the future.
One hack that came into my mind is to make ExternalContext session dynamically selectable. This only shifts problems to other areas even when not needing instance spesific sessions, since somehow JSF needs to transfer the state over portlet's processAction to renderRequest. This may even be against JSF spec and it doesn't concern the Seam implementation. Note that it requires access to the JSF binaries. I wouldn't go this way myself all the way, but this could propably be used to some sort of prototyping due to the benefit gained from Seam annotations that avoid completely the use of
((javax.portlet.PortletRequest) getFacesContext().getExternalContext().getRequest()).getPortletSession(). Knowledge of how MyFaces PortletExternalContext works is needed.