AppWeb Samples

AppWeb includes a suite of programming samples that demonstrate basic use of the APIs.  Our goal is to get you running as quickly and easily as possible. If you find that a sample that you need is missing, please email .

The AppWeb samples are included with releases of Mbedthis AppWeb. The samples include full source code, makefiles and project files (for Windows). You can build the samples or cut and paste code into your own applications. These samples are installed by default at /samples and at /usr/share/appWeb-VERSION for Linux. Each sample is a stand-alone directory that may be relocated or copied to any directory. For Linux a pre-supplied Makefile will be used to build the sample. For Windows, a Visual Studio project is supplied.

NOTE: Please read Embedding AppWeb and Programming Paradigms first before trying the samples.


Samples Overview

If you want to embed HTTP server functionality in your application the key samples are:
If you want to embed your application into the AppWeb server as a module, the key samples are:
If you want to create an AppWeb handler that will create dynamic content, such as a PHP handler, the key samples are:

Programming Languages

The samples are grouped by programming language. Most samples are provided as both C and C++ samples. The samples to create AppWeb handlers or modules are only relevant in C++.

Threading Models

The differences in AppWeb APIs when using single Vs multithreaded models are quite small. Most samples pick a model, either single or multithreaded, but in most cases except where explicitly documented, the sample will work either single or multithreaded.

AppWeb Configurations 

The samples can only use features that have been built into the installed version of AppWeb. If you have recompiled AppWeb from source and have tailored the selected features, some of the samples may not run.

Building Samples

Building on Windows

AppWeb includes several project workspace files for building the samples.

Workspace File
Description
C++/c++Samples.dsw Builds all files necessary for the appWeb program. Includes building all loadable modules.
C/cSamples.dsw Builds the HTTP client.

To build using Visual Studio 6 open the workspace files with a "dsw" extension. To build using Visual Studio.NET, open the workspace files and upgrade them to Visual Studio.NET solution files.

Building on Linux

You can build the samples by typing: make. You can clean the directory by typing make clean.

Supplied Samples

Sample Name
Languages
Threading Event Model
Description
simpleServer
C, C++
Multithreaded. Service thread using select
Main program HTTP server
simpleEsp
C, C++
Single / Multithreaded.
Main program HTTP server
simpleEgi
C, C++
Single / Multithreaded.
Main program HTTP server
simpleModule
C++
Multithreaded.

AppWeb module
pollEventLoop
C, C++
Single-threaded
Polling in main program
Main program HTTP server
selectEventLoop
C, C++
Single-threaded Exposed select in main program
Main program HTTP server
winEventLoop
C, C++
Single-threaded Windows messages
Main program HTTP server
simpleClient
C++
Multithreaded

Main program using the HTTP client
simpleHandler
C++
Multithreaded.

AppWeb module
goaheadCompat
C
Single-threaded
Main program HTTP server

GoaheadCompat

The goaheadCompat sample demonstrates API compatibility with the GoAhead Web server product. See the C sample.

PollEventLoop

The pollEventLoop sample demonstrates how to use a polling event loop in your main program to service AppWeb events. The sample is single-threaded. See the C and C++ samples.

SelectEventLoop

The selectEventLoop sample demonstrates how to use a POSIX select event loop in your main program to service AppWeb events. The sample is single-threaded. See the C and C++ samples.

SimpleClient

The simple HTTP client sample demonstrates how to add HTTP client functionality to your C++ application. See the C++ language sample.

SimpleEgi

The simpleEgi sample demonstrates how to create and use Embedded Gateway Interface (like in-process CGI) to process posted HTTP Forms. See the C and C++ samples.

SimpleEsp

The simpleEsp sample demonstrates how to create and use Embedded Server Pages to create dynamic content. See the C and C++ samples.

SimpleHandler

The simple handler sample demonstrates how to create a dynamically loadable URL handler to process URL requests inside the AppWeb server. The interface portion of AppWeb handlers are written in C++. See the C++ sample.

SimpleModule

The simple module sample demonstrates how to embed your application into AppWeb by creating an AppWeb loadable module to extend the functionality of the AppWeb server. Modules use C++ interface code. See the C++ sample

  SimpleServer

The simpleServer sample demonstrates how to add HTTP server functionality to your application. The sample is multithreaded. See the C and C++ samples.

WinEventLoop

The winEventLoop sample demonstrates how to use a Windows message event loop in your main program to service AppWeb events. See the C and C++ samples.


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