Partial Java Server Pages and Servlet implementation in C++. Written as Apache 2.0 modules with much pressure put on performace.      

C++ Server Pages

Welcome to the C++ Server Pages project website.
This project provides you with the possibility to write C++ Servlets and C++ Server Pages for the Apache HTTPD Server.
If you have any questions pleas email me: or post a comment to any article.

C++ Server Pages vs. CPPSERV benchmark


Tests were done using Apache Benchmark command line utility (ab) with -n 100 (Number of requests to perform) and variable -c (Number of multiple requests to make)

Talks with CPPSERV admin Ilya A. Volynets-Evenbakh

Ilya A. Volynets-Evenbakh - the admin of CPPSERV has contacted me using on the SF forum. CPPSERV is a C++ Servlet Server - a very similar project to C++ Server Pages.
The discussion has resulted in an idea to introduce compatibility between the projects. As C++ Server Pages's servlets are executed in single-threaded multi-process environment and CPPSERV are in multithreaded single-process the C++ Servlet developer will now have a different choice in servlet containers.

New release of C++ Server Pages

C++ Server Pages 1.0.2 is now available for download

This release focuses on making the install process of less pain.
The used Boost libraries are now included with the sources.
A few bug in the Makefiles are now fixed.
I was able to successfully run C++ Server Pages on one of the SourceForge's Compile Farm servers (x86-linux2 - Fedora with Linux 2.6)

Creating a Book Store using C++ Server Pages. Part I


This is the first part in a series of tutorials. I'm going to explain how I've written
a book store, which is included in the sources of this project. You can see how
the book store look like right now. Here is a PHP version of the store, on which
the C++ Server Pages version is based.

Maturity and usage


C++ Server Pages quite mature. A complete internet book store can be build using CXXSP. Such example application is included in the sources.
It can be found in the store folder inside the archive.
The store is a complete and exact rewrite of this PHP version.

First C++ Server Page


Lets create a simple C++ Server Page.

First C++ Servlet


Having set up the environment it time to deploy the first C++ servlet.
Here are the steps to guide you through the whole process.



The archive with the sources of the project contains a Makefile in the cxxsp directory. It defines several configuration variables. Here are the most important ones:

  • APACHE_HOME - path to the directory where Apache HTTPD 2.0 is installed
    Apache must be compiled with so (./configure --enable-so) support.
    You'll need to add the following lines to your httpd.conf file:

       ServletInclude /path/to/header/files/cxxsp/mod_servlet/servlet/include
       BoostInclude /path/to/header/files/cxxsp/stripped-boost/
       AddHandler cxxsp .csp
       AddHandler servlet .sxx

Command make install executed in the directory cxxsp should install the modules (mod_servlet and mod_cxxsp) in the Apache installation pointed by APACHE_HOME variable.

The command make deploy will copy all the examples and start the Apache server pointed by APACHE_HOME



The implementation was written under the GNU/Linux operating system. It was tested on Gentoo-r8 with a Linux 2.4.20 kernel. It should work under any GNU/Linux distribution. The source compiles with gcc-3.3.5.

This project requires the following software to compile and work: