When embedding Appweb in your application or system, you have a three options. You can
-
Run the Appweb server as a stand-alone HTTP web server.
-
Embed the Appweb HTTP library (libappweb) in your
application so your application becomes a HTTP server.
-
Embed your application in the Appweb server as a dynamically loadable module.
When you run the stand-alone Appweb server, you are using Appweb in a manner similar to most
other web servers. However, Appweb is uniquely suited for such use in embedded systems. See
below for more information.
When you embed libappweb in your application, you extend your
application to listen for HTTP requests and thus become a HTTP server. Embedding the Appweb
library is easy and requires about a 10-20 programming statements depending on your programming
paradigm.
To create an Appweb dynamically loadable module, you need to create a DLL or Unix shared
library that contains both your application and some interface code into Appweb. This module is
then specified in the Appweb configuration file so that Appweb will load it when initializing.
It requires about 20-30 lines of C++ interface code to become an Appweb module.
This document further describes these embedding choices and helps guide you to the best
option for your application.
The Appweb
ServerThe Appweb product comes with a fully featured application that uses the Appweb HTTP
library to create a stand-alone server. This HTTP server is installed by default when you
install Appweb. This server is ideal for embedded systems as it offers the following features:
-
High performance
-
Deterministic memory footprint and CPU loads
-
Configurable threading parameters that control the memory requirements.
-
Configurable sandbox limits
Compared to other enterprise servers, Appweb is faster, much smaller and more
deterministic in its use of system resources.
On Windows, appweb is capable of running as a Windows Service or as a normal Windows
program. The console version will execute within a command window and is often useful for
debugging.
You should use the Appweb stand-alone server if the following are true:
-
You are only using static content such as HTML pages and graphics.
-
You are only using standard content generation supported by Appweb. Such as: CGI
programs or scripting.
-
You already have your presentation layer separated from your application logging and
you only want to host your existing presentation logic.
-
You are migrating from Apache or IIS and you want to minimize the impact to your
application.
As the Appweb server is installed by default, you do not need to do anything extra to
start or run it. If you do change the Appweb configuration file, you will need to restart it
for your changes to take effect.
Redistributing the Appweb ServerTo redistribute the Appweb server, you need to include
the following files found under the Appweb installation directory along with any server
certificate and authorization password files you may have:
-
lib/*
-
logs
-
appweb.bmp
-
appweb.ico
-
mime.types
-
appweb.conf
Embed the Appweb
Library
You should embed the Appweb HTTP library in your main program if any
of the following are true:
-
You have a very large application and it would be difficult or infeasible to package
it as a simple Appweb module.
-
Your main program has a complex setup and it needs total control when
initializing.
-
Your application has a complex internal threading or event mechanism that needs to
have control over all threads in the system.
-
Your programming paradigm or architecture cannot be accommodate inside Appweb as a
module.
- You don't have access to a C++ compiler to create an Appweb module.Â
Linking with the Appweb LibraryTo link your program with the Appweb library you need
to do the following things:
-
Add  #include "appweb/appweb.h"  to the relevant source files.
-
Add the Appweb library to your Makefiles and Windows project files. This will mean
adding libappweb.dll on Windows or libappweb.so on Unix.
Redistributing Your ApplicationWhen redistributing your application with Appweb
embedded, you will need to include the libappweb.dll or libappweb.so library with your distribution.
Creating an Appweb
Module
You should embed your code into Appweb as a module if the following are true:
-
Your application does not have extensive interfaces other than via HTTP.
-
Your application is a scripting engine like JSTL or PHP and it needs to execute
within Appweb.
-
Your application is a security protocol stack like SSL.
-
Your application is a content handler like Active Server Pages.
Redistributing Your ModuleAfter you have created your Appweb module, it can be
distributed as a single DLL or shared library file. You may wish to include this as part of a
larger application or you may want to have Mbedthis distribute this on its www.mbedthis.com web
site from the contributed modules section.
|