Sun Java System Portal Server 7 Developer's Guide

The Provider Life Cycle

This section describes the lifecycle of the provider per user session. Figure 2–2, Figure 2–3, and Figure 2–4 shows how the Desktop handles each user session.

A session is created at the time the user logs in to the portal Desktop and ends when they logout. The session also ends when the user session is idle, or when the session times out. For authless logins, a single session is shared amongst all clients accessing the Desktop in authless mode, and the authless session never dies.

For each request, the DesktopServlet will validate the user session; if it is a valid session, the DesktopServlet will start to process the request. If a session does not exist, the DesktopServlet will create a session.

The creation of the provider context is equivalent to the creation of a session. The container provider context object is generated and maintained, one per session. So each time a request comes in, the cached container provider context object is used. For example, in Figure 2–2, when the first initial request comes in, the container provider context is created and initialized, and when the subsequent requests come in, as in the reload and logout requests shown in Figure 2–3 and Figure 2–4 respectively, the cached container provider context is returned.

The container provider context maintains a list of its contained provider objects and their cached content locally. Contained providers are created and initialized once per session, and their content is cached in the provider context object. Subsequent requests access the cached provider objects that live inside the provider context object.

The contentChanged() and allContentChanged() methods signify that either the conChapter 3, Overview of the Desktop Servlettent for one channel or all channels has changed, respectively. This is used to remove all the cached content for the channels, as well as to clear the cached provider objects. When the requested action is logout, as shown in Figure 2–4, the DesktopServlet will redirect the request to the logout URL, and the session will be destroyed. At this point, the provider context object is removed from the cached list, and ready for garbage collection. Also, if the session expires or times out, the provider context object is removed from the cached list.

Figure 2–2 The Provider Life Cycle - Initial Request for Authenticated User

This flowchart shows how the DesktopServlet processes a user’s
initial request.

Figure 2–3 The Provider Lifecycle - Desktop Reload Request for Authenticated User

This figure shows how the DesktopServlet handles a reload request
from authenticated users.

Figure 2–4 The Provider Lifecycle - Logout Request

This figure shows how the DesktopServlet handles logout request.

Figure 2–2 and Figure 2–4 shows a sample of how the content and logout actions are processed. For detailed information on how the DesktopServlet and the back end providers handle each action (including content and logout), see Chapter 3, Overview of the Desktop Servlet.