User-defined actions are CGI applications or plug-ins that are invoked not because of a direct reference to their URL, but rather because of a reference to a file mapped to the action's file suffix. Using actions has two major advantages over direct CGI references: the ability of a CGI to easily work with multiple URLs, and the ability to change the CGI without having to change URLs on your site.
A good example of using user-defined actions is the handling image maps. If your site has multiple image maps, you could configure all URLs ending in .map to be handled by a single CGI, for instance "imagemap.cgi". First, you would create an entry in the Action dialog panel associating an action name (in this example "imagemap") with the path to the CGI application (":imagemap:imagemap.cgi"). Next, in the MIME Mappings dialog, you would create an entry associating the suffix ".map" with the action name ("imagemap"). With these entries completed, when a user access a .map URL, such as "http://www.yoursite.com/graphic.map", Quid Pro Quo will launch the imagemap.cgi CGI application, passing it the map coordinates to resolve. To change the map handling CGI, all you would have to do is change the path to the "imagemap" action. For instance, change ":imagemap:imagemap.cgi" to ":MapServe:MapServe.cgi".
Plug-ins set their own action paths when they are registered at Quid Pro Quo start-up time. They are not user editable.
Actions allow you to add to Quid Pro Quo's built-in capabilities. You associate a file's suffix with the action that Quid Pro Quo is to perform when a request for that file arrives. For instance, a file with the suffix .html is typically mapped to the Text action. When a user requests "default.html", Quid Pro Quo performs the Text action, which is to send the file to the client in plain text form. Other built-in actions perform similar functions.
When a request comes in for a user-defined action, Quid Pro Quo launches the CGI application or plug-in specified by the action path. Quid Pro Quo then sends an AppleEvent to the CGI describing the client's request, which the CGI processes and returns a result to the server. Quid Pro Quo sends the result to the client without performing any further processing.
Paths should be made relative to the folder that contains the Quid Pro Quo application. Since a relative path always begins with a colon, be sure to preface your path with a colon. Otherwise, the path will be interpreted as a full pathname, and your action handler will not be found. If your CGI action handler is in the same folder as the Quid Pro Quo application, do not preface it with a colon. For instance, the full path to these action handlers is:
Macintosh HD:Quid Pro Quo:imagemap:imagemap.cgi
Macintosh HD:Quid Pro Quo:actionhandler.cgi
would be represented as (assuming the Quid Pro Quo application is in the folder 'Macintosh HD:Quid Pro Quo:'):
For information on mapping a file suffix to action, see the section on MIME Mapping.
Welcome | Contents | Glossary