In this section I'll explain how the OAS and WebDB servers apply the ideas introduced in the previous section to deliver content from the server to the client (e.g., URLs, virtual directories, ports, etc.).
Although the specific details vary, OAS and WebDB follow the same basic process model to deliver web content and rely on a virtual schema mapping called a Database Access Descriptor (DAD) to access the database. A DAD is similar to a virtual directory mapping; it creates a name, used within a URL, that links the request to a specific schema in the database.
Figure 2.1 illustrates the basic parts of the model.
A request begins when a user submits a URL or an HTML form to an OAS or WebDB server. A server component called the HTTP listener intercepts the request and extracts its path section. This step, called URL resolution , determines what type of resource the request is for and how it will be processed. If the URL's path section matches a virtual directory mapping, then the request is for a static resource and the HTTP listener returns the requested resource (if found) to the user's browser. If the path section matches a DAD stored in the server's configuration files, the request is for a dynamic resource and the HTTP listener forwards, or dispatches , the request to the PL/SQL gateway.
The PL/SQL gateway reparses the URL (or HTML form
The gateway uses the DAD configuration information to connect to the appropriate database schema, then executes the specified procedure, passing any parameters included in the call. The procedure, which executes directly inside the database, usually calls procedures in a set of packages called the PL/SQL toolkit . These calls create the page's contents by "printing" HTML tags into a temporary buffer. When the procedure completes, the gateway signals the HTTP listener to send the contents of the buffer -- now populated with the HTML output from the procedure -- back to the user's browser. The user's browser displays the page, just as it would any other static resource.
Let's look at this procedure in more detail, especially the functions of the HTTP listener and the PL/SQL gateway.
The HTTP listener is what we normally think of as the web server. Its job is to receive the requests users make with their browsers, determine how to process them, then return the requested resources (along with their MIME types) to the client machines that made the request. Most of the listener's life is spent monitoring a TCP port for requests made from a web browser. Although OAS and WebDB use port 80 by default, they can be configured to use other ports.
The HTTP listener makes static resources available by mapping physical directories on the OAS or WebDB server to a virtual alias. These aliases are used in the URL to request a static resource that resides in the corresponding directory. The goal is to give clients a uniform way to locate a resource that is independent from the operating system of the OAS or WebDB server. For example, on an NT server, you can map the directory c:\files\public\web_stuff to a virtual directory called web . URLs that need to access resources in the directory must use the alias "web", rather than the actual directory name, to retrieve static resources.
You can configure OAS to make subdirectories beneath a mapped directory accessible from the Web; WebDB maps subdirectories by default. The subdirectory name, as defined on the server's operating system, is appended to the "root" alias of the URL. For example, if c:\files\public\web_stuff had two subdirectories named bob and sue , the virtual mapping to them would be /web/bob and /web/sue .[ 2 ]
Since they include operating system specific names, subdirectory mappings are not completely platform independent. On Unix systems, for example, directory names are case sensitive, so the directories Junk and junk are not the same. Consequently, a URL that accesses a subdirectory on a Unix server must be case sensitive as well. Other platforms have similar caveats. The spaces in Win9x directory names cause all sorts of headaches, and the 3.x version has an eight-character limit. The best advice on any platform is to keep subdirectory names simple.
Both OAS and WebDB use the Database Access Descriptors to connect to a specific schema, which includes all the information necessary to establish a database connection, such as a username, password, and connect string. In either case, the DAD is mapped to a virtual alias that is used within a URL to select a schema.
OAS schema mappings have two parts: a DAD, which maps a schema, and agents, which map to a DAD. The agent name, not the DAD, appears in the URL to make the connection between the Web and the database. Both the URL and the
http:// server [ :port ]/ agent_name /plsql/[ package. ] procedure [ ?parm1=foo... ]
Here are a few examples:
http://gandalf/agent_webtest/plsql/print_all_emps http://gandalf/agent_webtest/plsql/show_emps?i_name=BOB http://126.96.36.199:8181/secure_agent/plsql/show_users http://betty/agent_webtest/plsql/forum.current_forum_list
http:// server [ :port ] /dad_name/ [ package. ] procedure [ ?parm1=foo... ]
Here are some examples:
http://pcandrew.ora.com/WebDB/WEBDB.home http://gandalf:8181/WebDB/show_emps?I_name=FRED+FLINTSTONE http://www.travel.com/travelers_site/flights.show_list?country=FR
Copyright (c) 2000 O'Reilly & Associates. All rights reserved.