Thursday, April 2, 2009

Understanding URL Syntax of Oracle Application Express

Oracle Aria (i.e., Oracle people search site; this is located in the intranet of Oracle) is built using Oracle Application Express. Oracle Application Express (Oracle APEX) is a rapid web application development tool for the Oracle database.

To build a Ubiquity command for Oracle Aria, you need to understand its URL syntax. Web application built using Oracle APEX is composed of multiple pages. Each application is identified by a unique number (i.e., application ID). Similarly, each page is uniquely identified by its page number.
Applications and pages may also have alphanumeric aliases. Application aliases are unique within a workspace and page aliases are unique within each application.

Understanding URL Syntax

The URL that displays for each page identifies the address of Oracle Application Express, the application ID, page number, and session ID. For example:

This example indicates:
  • is the URL of the server
  • pls is the indicator to use the mod_plsql cartridge
  • oracle is the database access descriptor (DAD) name. The DAD describes how HTTP Server connects to the database server so that it can fulfill an HTTP request.
  • f?p= is a prefix used by Oracle APEX
  • 8000 is the application being called
  • 1 is the page within the application to be displayed
  • 7528859885365 is the session ID

You can create URLs to access pages in your application using the following syntax:

Table 1 describes the arguments you can pass when using f?p syntax.

Syntax Description
App Indicates an application ID or alphanumeric alias.
Page Indicates a page number or alphanumeric alias.
Session Identifies a session ID. You can reference a session ID to create hypertext links to other pages that maintain the same session state by passing the session number.
Request Sets the value of REQUEST. Each application button sets the value of REQUEST to the name of the button. This enables accept processing to reference the name of the button when a user clicks it.
Debug Displays application processing details. Valid values for the DEBUG flag are YES or NO. Setting this flag to YES displays details about application processing.
See Also: "Debugging an Application"
ClearCache Clears the cache. This sets the value of items to null. To clear cached items on a single page, specify the numeric page number. To clear cached items on multiple pages, use a comma-separated list of page numbers. Clearing a page's cache also resets any stateful processes on the page. Individual or comma-separated values can also include collection names to be reset or the keyword RP, which resets region pagination on the requested page. The keyword APP clears cache for all pages and all application-level items in the current application and removes sort preferences for the current user. The keyword SESSION achieves the same result as the APP keyword, but clears items associated with all applications that have been used in the current session. See Also: "Clearing Session State"
itemNames Comma-delimited list of item names used to set session state with a URL.
itemValues List of item values used to set session state within a URL. Item values cannot include colons, but can contain commas if enclosed with backslashes. To pass a comma in an item value, enclose the characters with backslashes. For example:
PrinterFriendly Determines if the page is being rendered in printer friendly mode. If PrinterFriendly is set to Yes, then the page is rendered in printer friendly mode. The value of PrinterFriendly can be used in rendering conditions to remove elements such as regions from the page to optimize printed output. When the value is Yes, the Application Express engine will not display tabs or navigation bars, and all items will be displayed as text and not as form elements.

What Is a Session?

HTTP is a stateless protocol. In web browser, each page request is treated by the server as an independent event, unrelated to any page requests that happened previously or may occur in the future. Typically, when a user enters values into a form on one page, those values are not accessible on later pages.

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. It transparently maintains session state and provides developers with the ability to get and set session state values from any page in the application.

Using Zero as Session ID

Application pages that do not require authentication can be accessed with "f?p" URLs where the session ID is zero (that is, the single digit 0). When you request a page by either entering the URL in the browser or by clicking on a link having 0 for the session ID, the Application Express engine assigns a new session ID and sends a session cookie containing this new session ID to your browser. As you navigate through the application's public pages, you will see that all generated links to public pages will contain 0 for the session ID and all branches to public pages will have new URLs that use 0 as the visible session ID. Behind the scenes, however, the Application Express engine uses the session ID in the cookie as the actual session ID to locate session state.

This feature is useful when you want to hide the actual session ID. By hiding the session ID, you enable users to bookmark pages without needing to include the session ID in the bookmark link. As an added benefit, using zero as the session ID also keeps the actual session ID hidden from search engines.

No comments: