Module Netcgi_jserv_app

module Netcgi_jserv_app: sig .. end
AJP-based Application Servers

This module contains a "ready to use" application server framework for single-threaded and multi-process servers.

type request_handler = {
   req_activate : Netcgi_types.cgi_activation -> unit;
   req_processing : string -> Netmime.mime_header -> Netcgi.argument_processing;
   req_operating_type : Netcgi.operating_type;
The request handler consists of:
type server_type = [ `Forking of int * (string * request_handler) list
| `Process_pool of int * (string * request_handler) list
| `Sequential of (string * request_handler) list ]
Server type: In servlets the list of available servlets is passed. The strings are the names of the servlets (part of the URL), and the request_handlerss are the corresponding handlers.
type protocol_type = [ `Ajp_1_2 ] 
Selects the protocol.

type jserv_config = {
   js_backlog : int;
   js_reuseaddr : bool;
   js_cgiconfig : Netcgi_env.cgi_config;
   js_init_process : unit -> unit;
   js_fini_process : unit -> unit;
   js_idle_worker : unit -> unit;
   js_idle_master : unit -> unit;
Server configuration: Examples:
val std_config : jserv_config
The standard configuration:

val logger : (string -> string -> unit) Pervasives.ref
This variable contains the logger function. The function is called to log error conditions. The first passed string is the servlet name, or "?" if not available. The second passed string is the message. By default, the messages are written to stderr.
val run : ?config:jserv_config ->
server_type ->
protocol_type ->
(string * string) list ->
Netcgi_jserv.auth option -> Unix.inet_addr -> int -> unit
Starts the server. The last four arguments are compatible with the function accepted by Netcgi_jserv.jvm_emu_main, so run can be used as follows:

 Netcgi_jserv.jvm_emu_main (run ~config srvtype prttype) 

The server runs until it gets a shutdown notification from Apache.

Restart notifications are currently ignored.

Another remark about `Process_pool. The signal handler for SIGALRM is temporarily redefined while a process waits for a lock. The old handler is suspended until the lock can be acquired.