8.4 The SessionAppContext Class

The SessionAppContext class is intended to be used for applications which store state at the server. An inheritance diagram illustrates the relationship to the SimpleAppContext class described above.

Figure: The SessionAppContext class
 
\includegraphics[]{sessionappcontext}

Externally the execution context is almost identical to that of the SimpleAppContext class. Instead of saving session data in hidden HTML fields, session data is loaded and saved via a session server which is managed by the application.

The class defines a number of extra methods.

__init__(app)
When you inherit from the SessionAppContext class you must call this constructor.

The app argument is passed to the AppContext constructor.

write_headers()
Invokes the write_headers() method of the SessionServerContextMixin class to write the cookie header then writes the following HTTP headers.

Pragma: no-cache
Content-Type: text/html