zhxy/http服务器/appweb-4.3.4-0/doc/guide/appweb/programmers/rom.html

145 lines
7.8 KiB
HTML
Raw Normal View History

2022-01-06 15:41:19 +00:00
<!-- BeginDsi "dsi/head.html" -->
<!DOCTYPE html>
<html lang="en">
<head>
<title>Embedthis Appweb 4.3.4 Documentation</title>
<meta name="keywords" content="embedded web server, web server software, embedded HTTP, application web server,
embedded server, small web server, HTTP server, library web server, library HTTP, HTTP library" />
<meta name="description" content="Embedthis Sofware provides commercial and open source embedded web servers for
devices and applications." />
<meta name="robots" content="index,follow" />
<link href="../../../doc.css" rel="stylesheet" type="text/css" />
<link href="../../../print.css" rel="stylesheet" type="text/css" media="print"/>
<!--[if IE]>
<link href="../../../iehacks.css" rel="stylesheet" type="text/css" />
<![endif]-->
<link href="http://www.google.com/cse/style/look/default.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div class="top">
<a class="logo" href="http://appwebserver.org/">&nbsp;</a>
<div class="topRight">
<div class="search">
<div id="cse-search-form"></div>
<div class="version">Embedthis Appweb 4.3.4</div>
</div>
</div>
<div class="crumbs">
<a href="../../../index.html">Home</a>
<!-- EndDsi -->
&gt; <a href="index.html">Programming Guide</a> &gt; <b>Serving Pages from ROM</b>
</div>
</div>
<div class="content">
<div class="contentRight">
<h1>Quick Nav</h1>
<ul>
<li><a href="#compilingWebPages">Compiling Web Pages</a></li>
<li><a href="#php">Using ROM with PHP</a></li>
</ul>
<!-- BeginDsi "dsi/progGuideSeeAlso.html" -->
<h1>See Also</h1>
<ul class="nav">
<li><a href="../../../guide/appweb/programmers/index.html">Programmers Guide</a></li>
<li><a href="../../../guide/appweb/programmers/embedding.html">Embedding Appweb</a></li>
<li><a href="../../../guide/appweb/programmers/modules.html">Custom Modules</a></li>
<li><a href="../../../guide/appweb/programmers/handlers.html">Custom Handlers</a></li>
<li><a href="../../../guide/appweb/programmers/stages.html">Pipeline Stages</a></li>
<li><a href="../../../guide/appweb/programmers/migrating.html">Migrating to Appweb 4</a></li>
<li><a href="../../../guide/appweb/programmers/rom.html">ROM Content</a></li>
<li><a href="../../../guide/appweb/programmers/man.html">Manual Pages</a></li>
<li><a href="../../../ref/appweb/index.html">Programmers Reference</a></li>
<li><a href="../../../ref/appweb/architecture.html">Appweb Architecture</a></li>
<li><a href="../../../api/native.html">Native APIs</a></li>
<li><a href="../../../guide/appweb/users/index.html">Users Guide</a></li>
</ul>
<!-- EndDsi -->
</div>
<div class="contentLeft">
<h1>Serving Pages from ROM</h1>
<p>To enable Appweb to be used on an embedded system without a file system, 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.</p>
<p>Appweb has a virtual file system interface that allows the run-time switching between serving web pages
on a disk-based file system and a compiled ROM based store of web pages.</p>
<p>This ROM 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.</p><a id="compilingWebPages"></a>
<h2 class="section">Compiling Web Pages</h2>
<p>The Appweb <b>makerom</b> program is used to compile web documents, configuration files, and any other
files that you would like to be compiled into C code. The makerom 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.</p>
<p>For example:</p>
<pre>
makerom `find web -print` &gt;romFiles.c
</pre>
<p>This will create a list of all the web files and then convert these files into C structures in the file
romFiles.c.</p>
<p>The <b>makerom</b> program takes two options:</p>
<table title="Switches" class="width">
<thead>
<tr>
<th>Switch</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>--prefix</td>
<td>Specifies a leading string prefix to remove from each of the compiled file names. Filenames
should be relative paths and not start with "./".
</td>
</tr>
<tr>
<td class="nowrap">-- name</td>
<td>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.</td>
</tr>
</tbody>
</table>
<p>It is important to include some essential Appweb configuration files into the ROM. 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.</p>
<a id="php"></a>
<h2 class="section">Using ROM with PHP</h2>
<p>The ROM facility is supported by the following Appweb modules and handlers: fileHandler,
espHandler and the sslModule.</p>
<p>Ejscript and PHP do not support the Appweb ROM facility.</p>
</div>
</div>
<!-- BeginDsi "dsi/bottom.html" -->
<div class="bottom">
<p class="footnote">
<a href="../../../product/copyright.html" >&copy; Embedthis Software LLC, 2003-2013.
All rights reserved. Embedthis, Appweb, ESP, Ejscript and Embedthis GoAhead are trademarks of Embedthis Software LLC.</a>
</p>
</div>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1', {language : 'en'});
google.setOnLoadCallback(function() {
var customSearchControl = new google.search.CustomSearchControl(
'000262706376373952077:1hs0lhenihk');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
var options = new google.search.DrawOptions();
options.enableSearchboxOnly("http://appwebserver.org/search.html");
customSearchControl.draw('cse-search-form', options);
}, true);
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-179169-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>