Storing
Execution State
The portal content is handled stateless. An portal application has to keep track of its current execution state that includes, for example, the status of data handling. The portal works like a servlet. It uses a single instance to handle all requests from different users and different sessions. Therefore the current execution state cannot be kept in the portal application implementation class.
The following document contains detailed information about the different contexts to store data and the lifecycle:
http://<pdk-server>:<port>/irj/portalapps/com.sap.portal.pdk.htmlb.htmlbmanuals/ docs/usageofbeans.html
The component context can be used for application relevant data but it is not recommended. Data kept in the component object is not very secure. The component context can be released anytime by the container and replaced by another instance.
Data stored in the request context are available as long as the request object exists. It can be used to communicate between different components.
The POM node associated with the request object can be used to store custom attributes andcan be accessed with the method getNode().
Access to request context in portal application models
Basetype |
Access to IPortalComponentRequest |
IPortalComponent |
The request object is passed as parameter to the service method. |
AbstractPortalComponent |
The request object is passed as parameter to the do… methods. |
DynPage/JSPDynPage (PageProcessorComponent) |
In the (JSP)DynPage class, the request object is returned by method getRequest(). |
The session context can be used to for user specific data. The data is available as long as the browser session exists. It is accessible over the request object using the method getComponentSession().
The execution state in JSP-based portal components is usually handled with Java bean objects that are embedded into the page with the jsp:useBean tag. The lifecycle of these objects is managed by the JSP container according to the scope declared for the bean.
State management in portal application models
Scope |
Visibility and Lifetime |
application |
The data is shared by all instances of the portal application. The lifecycle corresponds to that of the deployed portal application. |
page |
The data is shared by all portal applications contained in the same page. |
session |
The data is shared by all portal applications that execute in the browser session. |
user |
The data is user specific. It is visible to all portal application instances used by the user, also for several sessions. |
Data stored in the user or application space have a long lifetime. Incomplete clean up procedures can have a significant impact on the performance of the overall system and can create memory leaks.