Modularity is important to promote separation and code re-use, so that each individual module, such as HTTP parameter parser, could be loaded independently by other programs with a short name 'web/cgi/module'.

Each module should distinguish between private names and public interface, marked with scriptdoc NB.* comments.

Compliance with API design guidelines is essential, addressing the needs of three levels of programmers. For example, in the same area of HTTP parameters:

API

Programmatic interfaces for application developer.

CGI Environment

HTTP Parameters

HTTP Headers

Output Writer

Error Handling

Cookies

Session

Optional session "object" support

Utilities

Static functionality for web-related processing, such as parsing, encoding and formating. Some of the functionality could be delegated to other addons.

HTTP Parameter Processing

Text Encoding

Mime Types

HTML Generator

This is meant to be used by non-web server programs like GUI HTML formatters, etc. Possibly this should be a separate addon: web/html.

HTTP Headers

Middleware

A set of handlers for executing high-level API frameworks such as JHP, Web Services.

Handlers are selected based on configuration and current file extension or file name, etc.

Generic handler for low-level handler implementation is provided for J scripts with .ijs extension. Developers can implement handlers for output images and other specific formats.

Middleware Execution
  • invoked by CGI integration layer, see Integrated execution

  • obtain basic interface to CGI integration, such as configuration properties, logging, etc.
  • obtain CGI adapter interfaces, environment, request, response
  • setup handler-specific interfaces: JHP, Web Services, etc.
  • setup error handling try/catch block
  • load and process script
  • execute script
  • process errors in middleware specific manner, e.g. error section in web service response
  • finalize execution
  • resume to Integration layer
  • Integration

    Interfacing with low-level web-server protocols: standard (default) CGI, enhanced CGI (FastCGI, SCGI), J stand-alone Web Server, as well as abstract interface with integration adapters created in the future. E.g. ASP.NET request handler can act as such adapter in a way similar to FastCGI/SCGI invoking J via COM or DLL while leveraging IIS for load-balancing, multithreading, etc.

    Integration Interfaces

    Adapter Interfaces

    Adapter

    Environment

    Request

    Response

    Configuration

    Setting up the front-end web server, J system, and CGI framework for mutual interaction.

    Web Server

    Vendor-specific host web server procedures

    J System

    CGI Framework

    Configuration file(s) with settings for various layers of CGI framework.

    Location
    Main config file should be located near J system to be found by the CGI boot code. Other, application-specific files, may be located in folders on the path from the web root to the current script folder.
    Settings
    The following sections or properties can be configured
  • integration
  • adapters
  • handlers
  • execution modes
  • logging
  • application parameters
  • CGI/Design (last edited 2008-12-08 10:45:34 by )