This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Portals and Portlets and the fly likes How do i get PortletContext in servlet.session.destroy.events Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "How do i get PortletContext in servlet.session.destroy.events " Watch "How do i get PortletContext in servlet.session.destroy.events " New topic
Author

How do i get PortletContext in servlet.session.destroy.events

Vinod Borole
Greenhorn

Joined: Feb 25, 2009
Posts: 26
Hi

Portal: Liferay 6.0

In my portlet i need to maintain an object at the application_Scope so that it will availaible for all the users that login. as a solution i thought PortletContext would be something i should use. Hence i went ahead and stored it in the portletcontext like this


Now when the user logsout i want to manipulate this object from the context, for this i wrote a hook that captures the servlet.session.destroy.events. Here is how the code looks like



As the above class has the HttpSession object, i can get the servletcontext and not the portlet context, still i tried but i could not get the attribute value that i had set in my portlet.

I thought i should set my object in the Servletcontext and then try, for that i my portlet i modified my code to get the servlet context object from the PortalUtil class like this


Even after doing this MySessionDestroyAction class does not get the context attribute. Can anyone explain this behaviour? Also, if this is not the right way to implement can anyone suggest what approach i should use.

Thank you
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do i get PortletContext in servlet.session.destroy.events
 
Similar Threads
HttpSession
Portlet Development
Test 399: IBM WebSphere Portal V5.1, Application Development
Websphere Portal - Test 399
which is evaluated first my taglib or jstl?