-
1. Re: Problem with PortletSession
aspdeepak May 5, 2009 3:05 AM (in response to aspdeepak)I some how found that there is an inconsistent (may be) behavior of PortletSession attributes, since the stored values vanishes after page rendering.
To be more precise the values become null after the page refreshes, I don't know whether this is a bug.
But I started using PortalSession object for storing the information
My new implementationString isFirst =(String) Navigation.getPortalRuntimeContext().getSession().getAttribute(IS_FIRST_LOAD); log.info(" IS_FIRST_LOAD (before) = "+isFirst+" for user["+request.getUserPrincipal()+"]"); if ( isFirst == null) { // if this is the first time loading Navigation.getPortalRuntimeContext().getSession().setAttribute(IS_FIRST_LOAD,"false"); log.info(" showing the default charts(COLLECTION since IS_FIRST_LOAD )"); log.info(" IS_FIRST_LOAD (after) = "+Navigation.getPortalRuntimeContext().getSession().getAttribute(IS_FIRST_LOAD)); ............................................................. ............................................................. }
HereNavigation.getPortalRuntimeContext().getSession()
returns the PortalSession -
2. Re: Problem with PortletSession
je.a.le May 6, 2009 4:31 AM (in response to aspdeepak)you should look for PortalEventListener.
when user login, logout or session expire, your listener will get a callback. You can set your portalsession attribute here. -
3. Re: Problem with PortletSession
aspdeepak May 12, 2009 7:06 AM (in response to aspdeepak)Thanks je.a.le for your solution
It would be the optimal solution for handling the user related events.
But I still can't understand why the PorteltSession gets cleared(null), when the portlet reloads.
But this is not the case in PortalSession it lives through out the user session.