Show TOC Start of Content Area

Background documentation Data Storing & Retrieving in the Portal  Locate the document in its SAP Library structure

The methods to store and retrieve data in the portal differ in the lifetime and accessibility. Lifetime is hard to guarantee in the portal. Lifetime can be very short - one request - or last the whole session. When using session keep in mind that the lifetime of a session is controlled by "external" events, like low resources on the server or time-out of the session, which will destroy the stored data in a session. The accessibility controls how "visible" the stored data is - can it be accessed by all users of the same component or only one user.

Storing data in the portal is generally not persistent. If you need persistent storing is needed we recommend a database.

In the Portal we have:

·        IPortalComponentContext

The IPortalComponentContext defines a user specific view on a Portal Component.

·        IPortalComponentSession

The IPortalComponentSession is the portal component's view on the servlet session. All objects stored in the Portal Component Session will be stored exclusively for the triple consisting of the Portal Component, the user id and the assigned scope. The lifetime of the shared session that is maintained by the portal environment should be determined by the portal setup only!

The IPortalComponentSession is a "sub session" of request.getServletRequest().getSession(). It is unique per user and Portal Component.

·        ServletRequest

ServletRequest is global for all Portal Components rendered in the same request (equals one Portal Object Model (POM) tree).

Caution

Be aware that even Portal Components on the same page are rendered in EP in different requests, because they are rendered in separate iFrames on the page! So you can't use the Servlet Request to transfer data between Portal Components! To use the ServletRequest makes only sense, if you combine two portal components in one request using the portal object model.

·        Node

Node is a unique element in the Portal Object Model (POM) tree.

·        HTTP Session

HTTP Session is global for all Portal Components in the same HTTP Session. You can exchange via HTTP Session data even on different pages.

 

The following table give you an overview of the different methods to store and retrieve data and the accessibility, persistence and lifetime. The table uses the variables:

IPortalComponentRequest: request

IPortalComponentSession: session = request.getComponentSession()

IPortalComponentContext: context = request.getComponentContext()

IPortalComponentProfile: profile = context.getProfile()

 

The table headers use following abbreviations:

S = Session specific

C = Component specific

N = Node specific

U = User specific

P = Persistent

 

Storing in/Methods

S

C

N

U

P

Lifetime

IPortalComponentContext

get: context.getValue()

put: context.putValue()

 

This graphic is explained in the accompanying text

 

This graphic is explained in the accompanying text

 

Refresh of component context

IPortalComponentProfile

Deprecated

get: profile.getValue()

put: profile.putValue()

scope for beans: application

 

This graphic is explained in the accompanying text

 

This graphic is explained in the accompanying text

 

 

IPortalComponentProfile

get: pro.getPropertyAttribute("key","val")

put: prof.setProperty("key","val")

 

This graphic is explained in the accompanying text

 

This graphic is explained in the accompanying text

This graphic is explained in the accompanying text

 

IPortalComponentSession

get: session.getValue()

put: session.putValue()
Option: Declaration of a scope

public static short SCOPE_UNIQUE = 0;

public static short SCOPE_CONTEXT = 1;

public static short SCOPE_COMPONENT = 2;

 

Default: SCOPE_UNIQUE

Scope for beans: session

This graphic is explained in the accompanying text

This graphic is explained in the accompanying text

This graphic is explained in the accompanying text*

This graphic is explained in the accompanying text

 

Maximum as long as the HTTP session

Servlet Request

get: request.getServletRequest().getAttribute()

put: request.getServletRequest().setAttribute()

scope for beans: request

This graphic is explained in the accompanying text

 

 

This graphic is explained in the accompanying text

 

Request

Node

get: request.getNode().getValue()

put: request.getNode().putValue()

This graphic is explained in the accompanying text

This graphic is explained in the accompanying text

This graphic is explained in the accompanying text

This graphic is explained in the accompanying text

 

 

HTTP Session

get: session.getHttpSession().getValue()

put: session.getHttpSession().putValue()

This graphic is explained in the accompanying text

 

 

This graphic is explained in the accompanying text

 

HTTP session

* Only if scope is set to SCOPE_UNIQUE

 

End of Content Area