How WebKit Works

The WebKit is a set of tools and routines that make it easy to use UniVerse to create and administer a web server on your UNIX host. WebKit provides a solid foundation for creating web applications that take full advantage of HTML forms and back-end processing.

WebKit Makes It Easy

WebKit routines make it easy to build complete applications with a web browser user interface. WebKit includes routines to:

  • Administer static HTML documents in the httpd document tree
  • Handle CGI argument string decoding
  • Create HTML documents dynamically
  • Data collection and reporting

WebKit is implemented using the powerful UniVerse database application development environment, and UNIX utilities. Because UniVerse combines the power of a post-relational database with an easy to use BASIC development language, all the programming and data handling needed for any web based application is done in one environment.

What is a Web Based Application?

A web application can collect information, control access to any part of it, and generate HTML documents dynamically from data stored in database files. For systems that will make use of the CGI interface, there are some requirements.

  • Each form or search mechanism will require specific programming.
  • The data that is collected is best maintained in a database, such as UniVerse.
  • The CGI programming environment will need to have an interface to the UniVerse database management system.

The programming environment should make it easy to transform data in any form, including database file information, into HTML documents on the fly. This will allow you to present any kind of data as a web document. WebKit makes it easy to develop a web based application.

The normal transaction on the Web is a request by a browser, for a document on a web server running httpd. The browser interprets a URL, uses the http protocol to contact the hpptd software on the specified server machine, and passes httpd the path of the requested document. The httpd process translates the URL path to a real path on the server local disk, retrieves the document and sends it back as is, to the browser.

WebKit API

The WebKit API is a series of UniVerse BASIC routines used to process HTML forms or to dynamically generate HTML documents from data stored in a UniVerse database. One set of functions is used to get and parse the information passed to a UniVerse program called by httpd, or to generate error output. The Tag functions generate HTML tag sequences. These routines provide the bulk of the online response, and are heavily used in coding of UniVerse BASIC programs that comprise the Internet to UniVerse connection.

CGI

The capability that opens up the Web as an interactive medium is web server support for execution of a program, in addition to requests for documents. Most web servers support a Common Gateway Interface, or CGI, to execute programs. Here's how it works.

The server administrator configures the httpd server to recognize certain pathnames as a request for program execution rather than a get document request. The two common ways this is done are:

  1. Designate a special top level directory as a CGI directory so that any pathname starting with it designates a CGI request.
  2. Specify that all filenames ending in a certain suffix (e.g., .exe) are requests for execution.

When the httpd process interprets a request for program execution, it creates a child process to run the program, passes it information in environment variables and possibly standard in, and sends back to the browser whatever is written to standard out by the program. For UNIX based http servers, the program can be any executable, including shell scripts. You could configure the httpd server to treat paths starting with /bin as requests for CGI program execution. The next token in the path is the name of the executable in that directory. Anything after that is passed as parameters to the CGI program.

Forms

You can use the CGI capabilities by specifying a URL that is a request for program execution, and you can pass parameters to the program using either the extra path method or the query method. A more powerful method for invoking program execution is the HTML forms capability. The HTML language contains tags which instruct the browser to display a variety of input controls. Basically, the browsers support input text boxes (single and multiple line), various kinds of buttons, and selection list boxes. To use a form, you must create an HTML document that specifies the controls you are using to collect the data you want, and the program to execute to process the data. The form must contain a special button called a submit type. When the user clicks on the submit button, the browser issues a request to the server to execute the specified program and it encodes the values in all the controls into an argument string. The server executes the program as we have described above, and additionally, puts the argument string into standard in for the program to read.

Customer Action Request Processing

The Customer Action Request is an online form that a requester will fill in when they want you to take some action. The data is collected from the form and stored in a UniVerse file that is then used for reporting.

A report is generated which displays the open CAR entries, latest first. For each entry in the report both the CAR ID number and the email address of the entry are active links. The email link will bring up the browser email client already addressed to the customer, so that the administrator can easily email the response to the customer.

The revise mode on the CAR entry is automatically invoked so the administrator can record the disposition or current action response for the entry. When the CAR action has been taken, the administrator enters a close date so the entry no longer appears on the open CAR report.