Embedding AppWeb

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 Server

The 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 Server

To 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 Library

To link your program with the AppWeb library you need to do the following things:
  1. Add  #include "appWeb/appWeb.h"  to the relevant source files.

  2. 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 Application

When 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:

  • You want customers to be able to use your application by simply loading an AppWeb module.

  • 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 Module

After 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 mbedthis.com web site from the contributed modules section.

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