mod_w2ml documentation

mod_w2ml software architecture
(in PDF, ODG)
software architecture

mod_w2ml is a module for the Apache HTTP Server. mod_w2ml is distributed by W2ML.com and has no relation with the Apache project. mod_w2ml is a W2ML processor.

Table of content

Requirements

Platform (CPU & OS)
mod_w2ml is distributed as a compiled executable. So, it only works on the target platform of the executable (x86 Linux for instance).
Apache 2
mod_w2ml is designed for the Apache HTTP Server version 2.0.x and 2.2.x. It does not work on previous versions (1.3.x) of Apache. Note that a module compiled for Apache 2.0.x is not compatible with Apache 2.2.x.

Installation

If you get mod_w2ml in a .tar.gz or .zip file, then you must manually install the module as explained herede.

  1. Uncompress the mod_w2ml archive.
  2. Copy mod_w2ml.so in your Apache modules directory (modules/ on the standard Apache distribution). Set file the same owner and access rights than for other modules.
  3. Copy the W2ML client support directory in your Apache documents directory (htdocs/ on the standard Apache distribution). Set file owner and access rights so that Apache can read them.
  4. Configure mod_w2ml in Apache (conf/httpd.conf on a standard Apache distribution, see Configuration chapter for more informations).
  5. Note that Apache need write access to W2ML files to perform many W2ML operations like edition, counting... Set file owner and access rights on W2ML files so that they can be written by Apache.
  6. (Re)start Apache.

Configuration

mod_w2ml is configured like other Apache modules in Apache configuration files. The standard Apache configuration file is conf/httpd.conf, but it may be another one on your system. UR

The module structure name is w2ml_module and the handler name is w2ml. They are hardcoded strings in the module used by the LoadModule and addHandler Apache directives. The W2ML module requires two additional directives: W2MLClientSupportBaseURI to build URI to (mostly JavaScript) files of the online editor, and W2MLLicenseKey for the license key. Finally, AddType sets the HTTP MIME type of responses generated by the module. You should set it accordingly with the DTD used in your documents. Note that the module always generates UTF-8 encoded text.
Here is a minimal configuration:

LoadModule w2ml_module modules/mod_w2ml.so
W2MLClientSupportBaseURI /w2mlclient
W2MLLicenseKey "848850856d4ed299798f-ExampleI-20061201-20061212-DEV"
AddType "text/html; charset=utf-8" .w2ml
AddHandler w2ml .w2ml

Please note that the license key of this example is not valid. You must get and configure a valid license key.

Here is a commented configuration with all options:

# The W2ML module must be loaded.
LoadModule w2ml_module modules/mod_w2ml.so

# They are 3 ways to specify which files are handled by the W2ML module:
# 1. by filename extension
AddHandler w2ml .w2ml
# 2. by location
<Location /dir/w2ml>
   SetHandler w2ml
</Location>
# 3. with the "application/x-w2ml+xml" MIME type,
# set here for files with .w2ml+xml extension
AddType application/x-w2ml+xml .w2ml+xml

# Set the MIME type of documents produced by the W2ML handler.
# Note that depending on the DTD found in the W2ML document,
# the W2ML module outputs HTML markup (default) or XHTML markup.
# Even when it outputs XHTML markup, "text/html" MIME type may
# be the better choice (for more info, see
# http://www.hixie.ch/advocacy/xhtml).
# The charset is always UTF-8.
AddType "text/html; charset=utf-8" .w2ml

# Enable exe URI scheme processing in W2ML documents.
W2MLEnableExeUriScheme
# Enable file URI scheme processing in W2ML documents.
W2MLEnableFileUriScheme
# Enable HTTP URI scheme processing in W2ML documents.
W2MLEnableHttpUriScheme

# Mutex file name. A default name is used if this directive is not present.
W2MLLockFileName w2mllockfile
# Shared memory name. Anonymous shared memory is used if this directive is not present.
W2MLShmFileName w2mlshmfile

# Here we set an additional MIME type associated with another
# file extension (for instance to display MathML or SVG in Mozilla).
AddHandler w2ml .xw2ml
AddType "application/xhtml+xml; charset=utf-8" .xw2ml

# Base URI of HTTP client W2ML support resources.
W2MLClientSupportBaseURI /w2mlclient

# License key(s). You may have several W2MLLicenseKey lines.
# See license for details on license keys.
W2MLLicenseKey "848850856d4ed299798f-Example0-20061201-20061212-DEV"
W2MLLicenseKey "8ed2950856d49798f848-Example1-20061213-20061213-DEV"

# Display index.w2ml instead of directory listing.
DirectoryIndex index.w2ml

# By default, the W2ML handler does not accept additional path
# in URLs, but "AcceptPathInfo On" overrides the default.
<Location /dir/w2ml>
	AcceptPathInfo On
</Location>

License

Module internal variables

mod_w2ml provides custom internal variables to get informations about license keys. You can display them in your pages with: <w2:v internal="internal variable"/>.

Internal variables for license keys
Internal variableMeaning
"past license key types" List of license key types that where in use the previous days (reset when the server is restarted)
"past licensed daily hit rates" List of licensed daily hit rates for the previous days (reset when the server is restarted)
"past actual daily hit rates" List of actual daily hit rates of previous days (reset when the server is restarted)
"license key type" License key type currently in use
"licensed daily hit rate" Licensed number of hits for today (reset when the server is restarted)
"actual daily hit rate" Number of hits today (reset when the server is restarted)
"future license key types" List of license key types for next days
"future licensed daily hit rates" List of licensed daily hit rates for next days

Daily Hit Rate

For mod_w2ml, a hit is a request that is handled by mod_w2ml. Requests that do not require mod_w2ml, like requests for static HTML files and pictures, are not counted by mod_w2ml.

If the licensed Daily Hit Rate is reached, then mod_w2ml will not stop processing requests. So, in case of slashdotting, mod_w2ml will not freeze your server.

Module specific W2ML implementation

Characters coding

Internally, mod_w2ml works in UTF-8. All output (HTTP response and file save) is in UTF-8. Depending on Expat, mod_w2ml may accept other encoding on input, but it will always be converted to UTF-8. Note that US-ASCII is a subset of UTF-8, so mod_w2ml works natively with US-ASCII.

If a non-UTF-8 W2ML file is modified, then mod_w2ml saves it in UTF-8. It also puts always put the XML declaration on save: <?xml version="1.0" encoding="UTF-8"?>.

Entities

Known character entities are converted to UTF-8 characters, except &amp;, &lt;, &gt;, and &#34;. The &gt; and &#34; entities are used only when necessary.

Markup generation

Whitespaces inside tags are not preserved. The apostrophe (') is never used for attribute value quoting.

If a W3C or IETF HTML pubid is found in the DTD of the requested W2ML document, then the HTTP response is formatted in HTML: attribute values are quoted only when necessary, namespaces are not output, empty HTML elements are recognized and no closing tag is output.

URI schemes

For the src attribute of inclusion elements, mod_w2ml supports the site, file, exe and http schemes. All schemes except site must be enabled by a configuration directive.

Online editor interface

This part describes the current implementation of the API between mod_w2ml and online editors. It is subject to change without notice.

If the W2ML document contains an ed attribute like:
<p w2:ed="wysiwyg">Bla.</p>
Then the HTML document output by mod_w2ml will automatically include scripts for the online editor, and attributes to identify editable elements:
<script src="/w2mlclient/main.js" type="text/javascript"></script>
<script src="/w2mlclient/window/main.js" type="text/javascript"></script>
<script src="/w2mlclient/edit/text/main.js" type="text/javascript"></script>
<script src="/w2mlclient/edit/wysiwyg/main.js" type="text/javascript"></script>
</head>
...
<p w2mledid="w2mle2l3.bQQCQaaE5o1sVV4Umwysiwyg" w2mled="wysiwyg">Bla.</p>
...
<script type="text/javascript">w2mlMain();</script>
</body>

For every element with the w2mled attribute, a class is dynamically added; w2mlwysiwygEditable in this case. This class can be used to apply styles to editable elements. Then, the editor registering function is called; w2mlRegisterwysiwygEditor in this case.

If the element is edited, then here is the HTTP request part that submits the edited element:
-----------------------------14643235191649919475440473999
Content-Disposition: form-data; name="w2mle2l3.bQQCQaaE5o1sVV4Umwysiwyg"

<p>Bla edited.</p>
-----------------------------14643235191649919475440473999--