When the solution matters

Tips...

4D v11 SQL (Current Version)4D 2004 Solution Accelerators Academic Downloads

Developing Mac OS CGIs

A CGI is any application that uses the Mac OS Common Gateway Interface standard to interact with an information server such as WebSTAR. The CGI standard defines arguments that allow the server to pass data to applications and receive data back from them.

You can develop a CGI to integrate with databases, process forms, and perform all sorts of other useful functions. CGIs can be developed and programmed in high-level scripting languages such as AppleScript, Frontier or MacPerl, or in low-level languages like C, Pascal or Java. Developing an application in a low-level language requires more effort but results in much better performance than an application developed in a scripting language.

The WebSTAR server itself does not process the data it sends to the CGI application or the pages it returns to the client software. The server's job is to handle connections, use the proper method to return pages and files, and handle communications between the client and the CGI.

CGIs must perform all HTML formatting themselves. The WebSTAR web server expects your script or application to generate and return a proper HTTP header and does no conversion of the return values from CGIs.

ACGIs and Asynchronous Processing

The WebSTAR server can interact with a CGI synchronously or asynchronously. If the name application ends with ".cgi", the server passes an Apple Event to the application and waits for the CGI to return a result (synchronous operation). If the application name ends in ".acgi", the server passes an Apple Event to the application and then continues processing other tasks until it receives a reply. Writing a CGI to be processed asynchronously is usually preferable.

AppleScript CGI Issues

WebSTAR Apple Events

The WebSTAR server includes Apple Events and application properties to set all configuration parameters. For the most part, the syntax of the data sent by the AppleScript Set commands, or returned by the AppleScript Get commands is the same as the syntax for setting parameters

Many of the application properties can be found in the Apple Event dictionary for the WebSTAR server, viewable in the Script Editor.

The WebSTAR server supports the four required Apple Events, plus a custom Apple Event suite for sending information to the WebSTAR server while it is running. The custom event suite provides the flexibility and power of WebSTAR CGIs.

The event suite for the WebSTAR server Apple Events is the same as the four-character creator code for the WebSTAR server application. The four-character Event Suite is WWW--three uppercase Ws (WWW), followed by the omega character "" (option-Z on the keyboard).



International | Company | Contact 4D | Site Map | Privacy Policy | © 4D UK 1995-2009 | Change font size: [A] [A] [A] | Print this page