Plasma GitLab Archive
Projects Blog Knowledge


[UP]
Modules
 Wd_application_dtd
 Wd_cycle
 Wd_dialog
 Wd_dictionary
 Wd_encoding
 Wd_interactor
 Wd_run_cgi
 Wd_run_jserv
 Wd_run_fcgi
 Wd_stdlib
 Wd_template
 Wd_templrep
 Wd_transform
 Wd_types
 Wd_serialize_types
 Wd_universe
 Wd_upload
 Wd_var_functions
   
WDialog API for Objective Caml: Wd_run_cgi

Module Wd_run_cgi


module Wd_run_cgi: sig .. end
This module contains a customizable main program for CGIs

val adjust_gc : unit -> unit
Adjust the garbage collector for short-living processes. This is recommended if used in a CGI environment.
val run : ?charset:Pxp_types.rep_encoding ->
?script:string ->
?self_url:string ->
?uifile:string ->
?session_manager:Wd_types.session_manager_type ->
?no_cache:bool ->
?error_page:(Netchannels.out_obj_channel -> exn -> unit) ->
?cgi:Netcgi_types.cgi_activation ->
?response_header:Wd_types.response_header ->
?reg:(Wd_types.universe_type -> unit) -> unit -> unit
A customizable "main program" which processes CGI requests and generates responses. It includes support for error handling.

The simplest way to make a working CGI program is to call run ~reg (); the argument ~reg registers the dialog classes. The other arguments have reasonable defaults for a normal CGI environment.

The function passed to ~reg gets the universe as argument. Its task is to register the dialog classes by calling the method register of the universe.

run loads the UI file, initializes the CGI environment, processes the request (see Wd_cycle), and generates the response. If an error happens, an error page is generated describing the exception. The optional arguments modify the standard behaviour:



charset : determines the character set for the internal representation of strings and for the generated HTML pages. (Note that the parsed XML files can have character sets independent of this setting.) The default is ISO-8859-1.
script : determines the file name of the invoked CGI script. This parameter sets default for the other parameters self_url and uifile as follows: The file name of the ui file is derived from ~script by changing the extension to ".ui" (or ".ui.bin" for compiled UI definitions). The default for self_url is derived from the basename of script. -- If script is not passed, it is derived from the (CGI) environment variable SCRIPT_NAME, and interpreted relative to the current working directory. There is normally no reason to pass ~script. EXAMPLE: If your script is called "index.cgi", the UI definition file "index.ui" or "index.ui.bin" is used.
self_url : the URL which refers to the current script. By default, it is derived from ~script. This value is put into the generated FORM elements as ACTION attribute.
uifile : is the path where the UI file can be found. By default, this argument is derived from ~script.
no_cache : If true: The CGI response contains header directives preventing the browser (and all caches between server and browser) from storing the response. This ensures that never a cache copy is taken, and for many browsers, the history is no longer usable (when hitting the "Back" button, the user only gets a message that the data is expired, but not the old page). The default is true.
error_page : This function is called when an exception is caught. It can generate an error page by writing a nicely formatted message to the output channel. The default is a function that outputs a simple error page.
cgi : This argument is the CGI activation object to be used. This object represents the "outer world" for WDialog. The default is to use the class std_activation (of Ocamlnet) implementing the CGI/1.1 standard.
response_header : If set, this parameter is taken as the initial HTTP response header while processing the request. If omitted, the response header defaults to: The content type is text/html, the character set as determined by charset, the caching header is set according to no_cache.
This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml