MPE Proglets

Here is yet another approach to generate dynamic web pages using plain MPE programs. I've coined the term MPE Proglet with the commonly known Java Applet or Java Servlet terms in mind. As you probably know, a Java Applet extends the functionality of a Java capable web browser with "user supplied" code, and a Java Servlet extends the functionality of a Java capable web server with "user supplied" code. Similar to Java Servlets, MPE Proglets are meant to extend the server side, however using native MPE program code. Unlike CGI programming, the MPE Proglet approach uses an MPE friendly way of passing parameters and results, though.

Concept

The basic idea of MPE Proglets is to use a small Java Servlet to interface a fairly straightforward MPE program to the web. The servlet is responsible for dealing with the incoming http request, whereas the MPE program implements native access to files or databases and creates the resulting HTML response. The servlet is fairly generic, so that the programmer can focus on the MPE code in most cases.

Unlike CGI, the Java Servlet and MPE program are not short-lived, but designed to handle multiple web requests over their lifetime. This helps to reduce the overhead caused by process creation/deletion or database opening/closing that is typical for CGI solutions.

An incoming browser request wakes up the Java servlet, which takes care of parsing parameters like QueryString, PathInfo, or HTML form fields and values. The servlet invokes (or awakes) the MPE program over a JavaTelnet session. The MPE program first performs a fairly simple prompt-and-response dialog with the servlet to retrieve the interesting http parameters. It then processes the input, using access to flat files, KSAM files, databases or whatever (native) MPE resources, and outputs a dynamic web page by displaying the results with appropriate HTML tags. The servlet passes the response back to the web client and then both, Java servlet and MPE program, wait until the next request from a browser comes in.

The prompt-and-response dialog between MPE program and Java servlet is fairly simple. It begins with the MPE program prompting for "HTTP> ", which the servlet answers with either GET or POST, depending on the type of http request. The MPE program can then prompt for additional info, like "PATHINFO> " or "QUERYSTRING> " or "SOME-HTMLFORM-FIELDNAME> ". The servlet answers these prompts with respective info from the http request. The MPE program ends the parameter dialog by introducing the resulting HTML page with "<html>" and ends the web page output phase with an "</html>" tag. At this point, the MPE program starts waiting for a new request by emitting the "HTTP> " prompt again.

Pro's

Con's

Misc

Examples

Please notice that the Proglet servlet and examples are just rough prototypes. Use and enhance at your own risk! You can run the above examples from Apache JServ or the servletrunner that comes with the Java Developer Kit. Note that the Transact/iX examples above are just used to demonstrate integration with MPE specific code (and because they allow coding TurboIMAGE access quite conveniently). The Command File examples show that there is nothing Transact specific about the MPE Proglet approach. You can easily implement examples in other programming languages, like COBOL, Pascal, C, Fortran, or Basic. I'd be happy to receive contributions in this regard ;-)
 
Lars Appel, 24-Apr-00 .. 15-May-00