CGI Services Architecture
The classical Hello World
Let's have a closer look at the "example.hello-world" CSA program (note the loosely Object-Oriented naming scheme here, see further down); if you followed the default directions provided in the
Basic application setup step, the actual script will be located in
For the rest of this document I will occasionally call an application a "class", and its individual scripts "methods". Although CSA isn't Object Oriented Programming in any true sense, I like naming things in this way. So let's call our first example script the "hello-world" method in the "example" class.
First, take a look at the actual
# Sample "hello-world" CSA application.Just one line of code, plus comments. Of course real-world scripts will usually be more than that, but even such a simple script can already show us how the CSA basics work. Open your Web browser and type the script URL (replace the relevant parts with your local values):
http://www.example.com/cgi-bin/CSA?0=example.hello-worldTell your browser to load that URL, and if everything was set up as explained you should see a response page with an "Hello World!" message on it. If that didn't work, please double-check all the setup steps that I have outlined above.
Some explanations are needed on the URL syntax first. The first part is pretty obvious:
http://www.example.comThe next part tells your Web server to call the CSA CGI front-end:
/cgi-bin/CSACSA is the CGI program that you copied to your
?0=example.hello-worldSince the CGI specs do not mandate that argument names use letters, I decided to use numbers for CSA own purposes, to make the syntax recall the familiar C-style argv argument list, where argv is the program name, and argv through to argv[n] are arguments. The adopted style is similar to the one suggested by spec n. 6 of the MIME-RPC proposed protocol.
Our "example.hello-world" script does not take arguments, but if it did they would therefore extend the above URL to become something like:
?0=example.hello-world&1=value1&2=value2&a=abc&b=123& ...I like to see this remote program invocation style as a kind of Web Command Line Interface, which I dubbed CSA-RPC.
Back to "example.hello-world", let's examine it a bit more in depth. All our program does is to call the CSA library function
The opposite of
Trackbacks (2) | New trackback | Print