Documentation generated by XL CLAIRE v3.3.37 at Sat, 25 Nov 2006
| categories mod_wcl Apache 2.x module configuration |
Communications between the Apache 2.x web server and a Web CLAIRE agent goes through the mod_wcl Apache 2.x module that requires to be configured in the Apache configuration syntax. The mod_wcl module understands a set of directives used to configure one or multiple Web CLAIRE services. mod_wcl supports per-directory configurations, also it's a good habbit to define a Web CLAIRE service inside a location block, for instance if we have a single service we may define our mod_wcl directives in a location block bound to the root path of the server :
| <location /> mod_wcl directives ... </location> |
| <location /> WclCommand /path/of/the/binary -wcl WclFileFilter *.wcl </location> |
Then we may define some user environment variables with the following directive :
| WclUserEnv ENV_VAR_NAME env_var_value |
We may also specify the name of a file that is taken a the default one when none are specified, this is done with the WclDefaultIndex directive. It allows the generation of an index page in a dynamic flavor without the need of an existing file :
| WclDefaultIndex name_of_default_index |
When we use sessions from our service (that is our service calls session_url or session_cookie) we have to specify a directory where session files are saved, optionaly we can specify a session name that will be used to generate the session file name :
| WclSessionName NAME_OF_THE_SESSION WclSessionPath /path/to/session_folder |
| WclTraceFile /path/to/trace_file |
| WclUserEnv HOME_DIR /path/to/custom/root_folder WclUserEnv SERVICE_BINARY the_name_of_my_binary WclCommand $(HOME_DIR)/path/to/$(SERVICE_BINARY) |
| WclTraceFile /path/to/trace_folder/$(REMOTE_ADDR).trace |
| categories HTTP headers |
| categories Misceleanous |
| categories Subscripts |
| categories Session |
Due to the architecture of client/server application we need a way to store server-side temporary datas between two client requests. These temporary datas are called session datas and are saved in a server side file between requests. A client is identified by a session ID that is transmited between the server and the client in each request. Wcl comes with two strategies for the ID transmition :
Once a session is started we may add new entries in the session. Entries are identified by a variable name (string) and may hold any object, the register register method would insert a new entry in the session, for instance :
| register("counter", 0) |
| (assert($["counter"] = 0)) |
| item <: ephemeral_object(name:string, quantity:integer) basket <: ephemeral_object(items:list[item]) (if ($["add_item"] & $["basket"]) $["basket"].items add item(name = $["name"], quantity = integer!($["quantity"]))) (session_url()) // starts a session (if not($["basket"]) // register a new basket rregister("basket", basket())) ?>Your basket : <table><? for i in $["basket"].items ( ?><tr><td><?== i.quantity ?> <?== i.name) ?></table><? ?>Add item to your basket : <form> <select name='name'> <option value='banana'>banana <option value='orange'>orange </select> <input type=text name='quantity'> <input type=submit name='add_item'> </form><? |
At the time a session is saved the session file is locked to avoid multiple write access so that, for instance, a page that defines multiple frames for a single session does not alter the session file.
| option index | Wcl srcipt | Wcl command line option |
Load the requested wcl file. One may test a single wcl file by specifying a <file> argument unless PATH_TRANSLATED is defined in the environment. In the later case a CGI environment is assumed as built by the mod_wcl Apache 2.x module.
| option index | Wcl script | Wcl command line option |
Load the wcl script <file>. A (unix) file may have execution rights and one can make a wcl script by adding as the first line of the script something like :
#!/usr/local/bin/claire -xwcl
When <S> and <W> are specified they are used to inititalize CLAIRE memory (see option -s).
| categories | Misceleanous | normal dispatch | Wcl method |
die() properly aborts the execution of the script and exits. If a session has been started and no error where issued by the script then the session is saved.
| categories | HTTP headers | normal dispatch | Http method |
force_content_length() forces the response to contain a Content-Length HTTP header. The default for HTTP/1.1 client is to transfer the response by chunks (chunked coding transfer). This would be necessary for instance when sending an application/pdf content type response to a Win32 client that uses Internet Explorer, this browser has difficulties to transmit a chunked encoded response to the Adobe Acrobat plugin...
| categories | HTTP headers | normal dispatch | Http method |
header(h) adds a custom HTTP header to the response. The specified header h should be a single line header without terminating CRLF. For instances :
| header("Some-Header: header-value") |
| categories | Subscripts | normal dispatch | Wcl method |
include(self) is the generic way (instead of calling load_wcl) to load sub-scripts. self is the path of the loaded subscript it is relative to the path of the main script.
| categories | Session | normal dispatch | Reader method |
register(varname, val) adds a new entry in the current session. After this call we have $[varname] = val.
| categories | Session | normal dispatch | Wcl method |
rregister(varname, val) adds a new entry in the current session. After this call we have $[varname] = val. rregister stands for 'recursive register' which means that the related objects are also registered (see serialize).
| categories | Session | normal dispatch | Wcl method |
session_clean_but(l) removes all datas from a session execpt those specified in l.
| categories | Session | normal dispatch | Wcl method |
session_clean_but(i) removes all datas from a session execpt i.
| categories | Session | inline | Wcl method |
session_cookie() starts a session. The ID of the session is transmitted in a cookie. The client should support and allow cookies. If a session with a matching ID already exists then its data are loaded in memory.
| categories | Session | normal dispatch | Wcl method |
session_destroy() detroys an existing session. If the associated file that contain session datas then it is unlinked.
| categories | Session | normal dispatch | Wcl method |
session_url() starts a client session. Unlike session-cookie(), session_url() transmit the session ID (which identifies the client) on the URL. It is a more portable way than session_cookie since it does not require that the client allows cookies. If a session with a matching ID already exists then its data are loaded in memory.
| categories | Session | normal dispatch | Wcl method |
unregister(self) remove the entry self from the current session.