Barracuda Application Server C/C++ Reference
NO
|
An HttpPage, which is typically created by the CSP compiler, is similar to a Java servlet.
Please see our introduction whitepaper for an introduction to server side scripting using the CSP compiler. See the device control whitepaper for an example of how to manually sub-class the HttpPage class.
The page service function cannot be a virtual C++ function since the code must be compatible with C. You must create a "static C++" callback method, which means that the method has no "this" pointer. The "this" pointer is passed into the static method as the first parameter in the callback function. The "static" callback function in the above code simply typecasts the HttpPage object to a MyPage object and calls the private service method, which has a "this" pointer.
Typical C usage:
#include <HttpServer.h>
Public Member Functions | |
HttpPage (HttpPage_Service service, const char *name) | |
The HttpPage constructor. More... | |
~HttpPage () | |
The HttpPage destructor unlinks the page from the parent directory. | |
const char * | getName () const |
Returns the page name. | |
void | service (HttpRequest *request, HttpResponse *response) |
The virtual service function (C callback function) is normally run by the parent directory when delegating the request to the page service method. | |
bool | isLinked () |
Returns true if this page node is installed into a parent directory. | |
int | unlink () |
Unlinks/removes the page from the parent directory. | |