Serving Pages from ROM

To enable AppWeb to be used on embedded systems without file systems, AppWeb supports the compilation of web pages and configuration files into C code that can be stored in Read Only Memory (ROM) and fetched by AppWeb to respond to relevant requests.

AppWeb has a virtual file system interface that allows the run-time switching between a web pages on a disk-based file system and a compiled ROM based store of web pages.
This ROMming facility may also be used to enhance security by preventing the modification of web documents or in performance critical situations were the serving of web pages from memory may be an effective optimization.

Compiling Web Pages

The AppWeb httpComp program is used to compile web documents, configuration files and any other files that you would like to be compiled into C code. The httpComp program will parse the files and convert them into C data structures which can then be compiled by your C/C++ compiler and linked into your application.

For example:

find web -type f -print >fileList
httpComp filelist >romFiles.cpp
cc -o romFiles.o romFiles.cpp

This will create a list of wall the web files and then convert these files into C structures in the file romFiles.cpp.

The httpComp program takes two switches

-p prefix
Specifies a prefix to remove from each of the compiled file names.
-r romName
Specifies the name of top level C structure. AppWeb allows multiple ROM directories to be included in a single application. This is necessary if using Virtual Hosts to allow each host to have its own web directory.

It is important to also put into the ROM the essential AppWeb configuration files. These include the AppWeb configuration file, the mime.types file and any authorization database files.  The following script is used to compile the web pages in three web directories ("sslWeb", "vhostWeb", and "web") and to also compile the essential configuration files.

find sslWeb vhostWeb web -print >rom.files \
echo -e '.\nappWeb.conf\nmime.types\nusers.db\ngroups.db' >>rom.files
httpComp rom.files >romFiles.cpp

Using ROM with PHP

The ROM facility is supported by the following AppWeb modules and handlers: authHandler, copyHandler, egiHandler, espHandler, sslModule and the openSslModule. PHP does not support the AppWeb ROM facility.

© Mbedthis Software LLC, 2003-2204. All rights reserved. Mbedthis is a trademark of Mbedthis Software LLC.