WebSpeed
Developer’s Guide


Running Procedures and Web Objects

The statement that executes a procedure in SpeedScript is the RUN statement. This statement has several forms, depending on the application. The most basic executes a procedure by name. If the named procedure is defined internally to the executing procedure file (or Web object), SpeedScript executes that internal procedure. Otherwise, it looks for an external procedure file to execute.

NOTE: In SpeedScript, an external procedure file is any legal set of SpeedScript statements in a file. The PROCEDURE keyword is needed only to define internal procedures.

You can also pass parameters to procedures that define them using DEFINE PARAMETER statements. For complete information on the options available for the RUN statement, see the Progress Language Reference.

Persistent Procedures

Among the most important forms of the RUN statement is the RUN statement using the PERSISTENT option. When you execute an external procedure, the PERSISTENT option causes the procedure context, including all of its data and internal procedure definitions to remain active in memory after the main-line of the procedure has returned to the caller.

This feature allows you to create (instantiate) SpeedScript objects, of which Web objects are the most important in WebSpeed. This is possible because when you RUN a procedure persistently, you can obtain a handle to the procedure’s active context. This procedure handle allows you to execute any internal procedure defined inside the persistent procedure context. You do this using the IN option of the RUN statement, where you run an internal procedure “IN” the handle of the persistent procedure. Thus, the persistent procedure maintains state for all of its internal procedure executions.

This is also how method and event procedures are implemented in WebSpeed. Generally, you run method procedures in the handle web-utilities-hdl (for the common utility method procedures in web-util.p) or the handle THIS-PROCEDURE (which references the current external procedure or Web object).

WebSpeed Calling Conventions

WebSpeed has a special set of procedure calling conventions. The first convention relies on the run-web-object method procedure. This procedure is the standard method to execute a Web object from within another procedure. It is also the basic method web-disp.p uses to execute Web objects in response to Web requests. The run-web-object procedure follows a protocol designed to ensure the integrity of the Web object, whether it is stateless or state aware. This allows WebSpeed to manage Web objects in a consistent manner. The run-web-object method procedure is defined in the utility object, install-path/src/web/objects/web-util.p.

The second convention relies on the dispatch method procedure. You use this procedure to execute event procedures, the special class of method procedures that you can override, but whose default code you cannot ordinarily change directly. The dispatch method procedure ensures that the override is executed rather than the default if the override exists. The dispatch method procedure is defined in the include file, install-path/src/web/method/admweb.i.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095