[Adept Development System] Servlets - Types and Uses

1 view
Skip to first unread message

Paul Marrington

unread,
May 18, 2005, 11:38:34 PM5/18/05
to adeptr...@googlegroups.com

An Action

is the most primitive servlet. It's used to give a command to the server when no response is expected - or when the response is processed externally. All servlets implement ActionInterface - defining the execute() method that's called by the connection manager. An action saves references to the request, response and parameter information blocks then calls process() - an Action inherits from this class and must implement the process() method.

The base Adept system includes one Action StopServer that, when given the correct password, will stop the server from the browser/client. The Action includes a go() method that can be used for invoking methods other than the default based on the _action parameter or a dot in the name (see above). If go() is used, the class can implement setup() and teardown methods to wrap common code around the action method called for.

CGI

is a method for Adept to run normal operating system dependant programs as CGI. A CGI program is independent. Anything output from is expected to be able to be rendered by the browser. Scripting languages such as Perl and Python have CGI libraries, but an program can generate a HTTP string and produce a valid display. If the script has an extension of cgi, the you don't need to explicitly mention the CGI servlet as in /mytest.cgi?param1=one. CGI programs of other names can be run if the servlet is explicit - /CGI?mytest.bat?param1=one. In all cases, in true CGI tradition, the output to the console is redirected to the browser.

Batch

is an extension of CGI for normal command-line programs that aren't browser aware. A batch builds up a valid HTTP stream and wraps the program output in <pre> tags so that they'll display as they would on a local terminal.

Exec

is designed for GUI applications where the browser and server are on the same machine. It will execute an operating system program then complete without waiting for interactions. With the Exec class you can create a program launcher using HTML on a web page.

A Service

encompasses the next level of sophistication over an action. It is designed to send information to the server where the responses will be JavaScript commands. It does use go() to call methods other than the default respond method. It is an abstract class, and respond() must be implemented. It contains a protected JavaScript instance for building JavaScript commands to give the browser. It has convenience methods to display a message on the status line and to pop up an alert box.

The Page

consists of a class file of the specified name in the package path and a HTML template file of the form className.template.html. First the target for all operations is set to the calling context/panel. Next, go() is called and if a non-default method is called, Page acts like any other Service. If the default is called, the template is sent, forms are activated and initialise called to continue class-specific initialisation. The JavaScript object allows scripts to be sent both before and after the HTML template. While the class is called Page, it's more often posted to the hidden service window where the HTML contains templates used to change the look and feel of an existing panel.

--
Posted by Paul Marrington to Adept Development System at 5/19/2005 01:26:00 PM
Reply all
Reply to author
Forward
0 new messages