Styles of Web Server Application
There are a number of differences between the different web server loading methods. Both
the CGI and ISAPI approaches use a main()
function that takes a
cgicall cgi
parameter. The main difference between the
two is what the current directory is. For CGI programs, the current directory is the same as
the location of the program that is being loaded, while for ISAPI programs, they normally
start in the %SYS32
directory.
The Fast-CGI program is quite different to the other two, though like with CGI, the
location of the program file is also the location of the current directory. Instead of a
main()
, there are three separate functions. They are:
fcgiinit()
, which takes no parameters, fcgi()
,
which takes a cgicall cgi
parameter, and an optional
type(*) <paramname>
parameter, which is the
return value from the fcgiinit()
function. Finally, there is an
fcgiterm()
function that takes the return value from the
fcgiinit()
function to allow any required clean up to take place. One
example of this might be if a dynamically loaded library is opened during initialization and
in that some memory is reserved. Then during the clean up phase that memory could be released.
In most SIMPOL web server programs, there will be little need for the final function, except
as an empty function so that it can be called although it will do nothing.
It is also worth mentioning that with advent of what has been called Web
2.0 that by using client-side JavaScript and a capability known as
AJAX (Asynchronous JavaScript and XML) a new approach to web server
applications has arisen, that are more about handling data requests and sending back the data
in a specific form. This technique makes use of the XMLHttpRequest
which,
in spite of its name, does not need to use XML. It can transfer data in other ways beside
using XML. The interesting part of this approach is that of sending pages back every time a
call is made to the web server, the application running in the web browser may only send out
data requests to refresh what is shown on the page being displayed. This is far more efficient
than sending along the entire page each time you send the data. There are two aspects of Web
2.0 really, one is related to this ability to update the data on the page without resending
the page, the other has to do with the use of a modern set of libraries to make web
applications look more like desktop applications and is embedded into various JavaScript
frameworks. JavaScript is still a frustratingly messy language, but it is showing signs of
growth. It remains to be seen how long it will take before it becomes easy to create an
application the way you want, rather than the way
they want.