Barracuda Application Server C/C++ Reference
NO
HttpSessionAttribute Struct Reference

Detailed Description

The interface to an HttpSession attribute.

Each attribute added to an HttpSession must inherit from this class. The HttpSession object calls the HttpSessionAttribute destructor when the HttpSession object is terminated.

The HttpSessionAttribute is an abstract class with a virtual destructor. We cannot use a "real" virtual destructor since the Web-Server must be ANSI C compatible. The function pointer passed in to the constructor is the function being called when the attribute is scheduled to terminate. The function pointer can be NULL if no cleanup is necessary.

Typical C++ usage:

class MyAttribute : public HttpSessionAttribute
{
public:
MyAttribute() : HttpSessionAttribute("MyAttribute", destructor) {}
private:
static void destructor(HttpSessionAttribute* o);
};
MyAttribute::destructor(HttpSessionAttribute* o)
{
delete ((MyAttribute*)o); // Run destructor and free memory.
}

#include <HttpServer.h>

Public Member Functions

 HttpSessionAttribute (const char *name, HttpSessionAttribute_Destructor terminate)
 Create a session attribute. More...
 
HttpSessiongetSession ()
 Get the session object.
 
HttpSessionAttribute
The interface to an HttpSession attribute.
Definition: HttpServer.h:1928