Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
toggle
Francesco Scali
Portlet session and Thread Safety
2 de Maio de 2012 06:30
Resposta

Francesco Scali

Ranking: New Member

Mensagens: 14

Data de entrada: 2 de Novembro de 2009

Mensagens recentes

Hi,
In Liferay 5.2.3 I'm using LIFERAY_SHARED_ prefix to share session attributes between the portal and the portlets.
Sometimes, but not always,from my IceFaces portlet I cannot retrieve the attribute previously set in session during my custom action (configured in servlet.service.events.pre) Do I have to access the session in synchronized mode? How is it possible (since in Icefaces session I cannot access the httpsession)?
The code I use to retrieve the attribute from the IceFaces portlet is:

FacesContext facesContext = FacesContext.getCurrentInstance();
PortletSession portletSession =
(PortletSession)facesContext.getExternalContext().getSession(false);
Object theSessionObj = portletSession.getAttribute(key, scope);

Thanks

Francesco
Neil Griffin
RE: Portlet session and Thread Safety
2 de Maio de 2012 15:11
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 2223

Data de entrada: 26 de Julho de 2005

Mensagens recentes

If you're using ICEfaces2 or ICEfaces3, then you can get the underlying HttpSession like this:
1import com.liferay.portal.util.PortalUtil;
2...
3FacesContext facesContext = FacesContext.getCurrentInstance();
4PortletRequest portletRequest = (PortletRequest) facesContext.getExternalContext().getRequest();
5HttpSession httpSession = PortalUtil.getHttpServletRequest(portletRequest).getSession();
Francesco Scali
RE: Portlet session and Thread Safety
2 de Maio de 2012 23:20
Resposta

Francesco Scali

Ranking: New Member

Mensagens: 14

Data de entrada: 2 de Novembro de 2009

Mensagens recentes

unfortunately we've got IceFaces 1.8.2 emoticon
Any way to do this ?
Neil Griffin
RE: Portlet session and Thread Safety
3 de Maio de 2012 05:39
Resposta

Neil Griffin

LIFERAY STAFF

Ranking: Liferay Legend

Mensagens: 2223

Data de entrada: 26 de Julho de 2005

Mensagens recentes

For ICEfaces 1.x I would recommend that you consider adding PortletFaces-Tools as a dependency to your portlet. It has some nice convenience features that provide improved ICEfaces 1.x integration with Liferay.

The problem is that ICEfaces 1.x only has access to Liferay-related objects during the initial RENDER_PHASE of the portlet lifecycle. After the initial render, ICEfaces 1.x does all the ajax calls with a servlet which does not have access to the original PortletRequest.

In particular, the Liferay.java class in PortletFaces-Tools shows how to cache important objects from PortletRequest during the initial render.

ICEfaces 2.x and 3.x does not have this problem, because Liferay Faces Bridge will use the RESOURCE_PHASE of the portlet lifecycle for Ajax, which always has access to Liferay-related objects.