HTTP, the protocol over which HTML pages are most often delivered, is a stateless protocol. A web browser is only connected to the server for as long as it takes to download a complete page. In addition, each page request is treated by the server as an independent event, unrelated to any page requests that happened previously or that may occur in the future. To access form values entered on one page on a subsequent page, the values must be stored as session state. Oracle Application Express transparently maintains session state and provides developers with the ability to get and set session state values from any page in the application.
A session is a logical construct that establishes persistence (or stateful behavior) across page views. Each session is assigned a unique identifier. The Application Express engine uses this identifier (or session ID) to store and retrieve an application's working set of data (or session state) before and after each page view.
Because sessions are entirely independent of one another, any number of sessions can exist in the database at the same time. A user can also run multiple instances of an application simultaneously in different browsers.
Sessions are logically and physically distinct from Oracle database sessions used to service page requests. A user runs an application in a single Oracle Application Express session from log in to log out with a typical duration measured in minutes or hours. Each page requested during that session results in the Application Express engine creating or reusing an Oracle database session to access database resources. Often these database sessions last just a fraction of a second.
See Also:
"Viewing Active Sessions" in Oracle Application Express Administration GuideThe Application Express engine establishes the identity of the user for each page request and the session ID to fetch session state from the database. The most visible location of the session ID is in the URL for a page request. The session ID displays as the third parameter in the URL, for example:
http://apex.somewhere.com/pls/apex/f?p=4350:1:220883407765693447
In this example, the session ID is 220883407765693447.
Another visible location is in the page's HTML POST data and indirectly in the contents of a session cookie. This cookie is sent by the Application Express engine during authentication and is maintained for the life of the application (or browser) session.
Oracle Application Express assigns new session IDs during authentication processing, records the authenticated user's identity with the session ID, and continually checks the session ID in each page request's URL or POST data with the session cookie and the session record in the database. These checks provide users with flexibility and security.
While the session ID is the key to session state, the session cookie and the session record safeguard the integrity of the session ID and the authentication status of the user.
The behavior of an Oracle Application Express application is usually driven by values in session state. For example, a button may display conditionally based on the value of an item session state. You can view the session state for a page by clicking Session on the Developer toolbar.
The Session State page provides valuable information about the session in which the application is currently running. To locate a specific page, enter the page number in the page field and click Go. Table 2-1 describes the various types of information available on the Session State page.
Table 2-1 Information Available on the Session State Page
Heading | Description |
---|---|
Application |
Identifies the application name. |
Session |
Summarizes session state for the current session. |
User |
Identifies the current user. |
Workspace |
Identifies the current workspace ID. |
Browser Language |
Identifies the current browser language. |
Page Items |
Identify attributes of the page item, including the application ID, page number, item name, how the item displays (for example, check box, date picker, display only, text field, hidden, popup, radio group, and so on), the item value in session state, and status. The Status column indicates the status of the session state. Available values include:
See Also: "Understanding Page-Level Items" |
Application Items |
Application items are items that do not reside on a page. Application items are session state variables without the associated user interface properties. See Also: "Understanding Application-Level Items" and "Understanding Substitution Strings" for information about referencing item values |
See Also:
"Managing Session State Values"