File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Portals and Portlets and the fly likes Application Scope Session in IBM portal server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "Application Scope Session in IBM portal server" Watch "Application Scope Session in IBM portal server" New topic
Author

Application Scope Session in IBM portal server

Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Hi,

What does application scope really mean? I have a application in which i have three portlets. I want to access a variable thru all the portlets so i set that variable in application scope like

when i log off portal and re-login i couldn't find that variable in the session. I want the variable to be in the session even when the user logs off portal server. could any one take me in the right direction.

Thanks,
Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
Could any one please help me!

Thanks,
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

((PortletRequest)request).getPortletSession().setAttribute(key, value, scope);

Well, the getPortletSession() would imply that you have set the attribute in the Session scope, NOT the application scope!

You might find this tutorial on Portlet config objects interesting. It might help you out:

Understanding Portlet Configuration Objects - PortletContext, PortletConfig, Application Scope, PortletSession

-Cameron McKenzie

-Cameron McKenzie
Saathvik Reddy
Ranch Hand

Joined: Jun 03, 2005
Posts: 228
McKenzie,

Thanks for you reply. I am putting the variable in the application scope by specifying scope as PortletSession.APPLICATION_SCOPE. Below is the code snippet:


I login to portal with portal admin user name/pwd.
I have no problem accessing this variable from different portlets.
But when i log off portal admin and re-login the application scope variable is null. Is this the desired behavior.

Thanks,
sujith Acharya
Ranch Hand

Joined: Dec 25, 2006
Posts: 60
HI,
You are not storing the object in appliaction scope, instead you are storing in session scope. So the object you stored will be available only till the session is alive. Once the session is deactivated, the object is no longer available.
The session will be deactivated once you are logged off. Hence when you are retreiving back after relogin , you are getting null
Kirk Schuller
Greenhorn

Joined: Jul 08, 2008
Posts: 1
I think application scope in this case means that the session attributes in the PortletSession will be available to other portlets running in the portal at the same time. At the end of the session though, they are released.

Hope this helps.
[ July 08, 2008: Message edited by: Kirk Schuller ]
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

other portlets running in the portal at the same time


Regardless of the scope, portlets from separate war files will never be able to share PortletSession data. The APPLICATION_SCOPE of the PortletSession only mitigates the sharing of data between portlets packaged within a common web application archive.

For true global information sharing, you need to create some kind of Portlet Service, Web Service, or commonly accessible database table.

-Cameron McKenzie
Praveen Belkar
Greenhorn

Joined: Feb 15, 2007
Posts: 13
Cameron,

Please clarify me this. In srikanth's problem, suppose the data to be persisted is of type String only, then can this problem be solved by storing the values in PortletPreferences object instead of storing in database?


Praveen<br />IBM Websphere Portal Application Developer 5.1<br />SCBCD<br />SCWCD<br />SCJP<br />IBM Tivoli Identity Manager Deployment Specialist 4.6
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Well, remember, PortletPreferences are stored permanently, whereas the session data disappears after the user logs out. Also, the user must be in the edit mode of the portlet to change or update the PortletPreferences object. That's probably too restrictive given the scenario.

-Cameron McKenzie
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Application Scope Session in IBM portal server
 
Similar Threads
portlet
J2EE Application to Portlet
portlet and servlet
Portal server Bea vs IBM
How to display the results of one portlet in another portlet(JSR 168 )?