MaSession Class Reference

#include <http.h>

List of all members.


Detailed Description

Session data store to store user's state data.

The MaSession class provides persistent data storage for user's state data accross multiple requests. The MaSession is a subclass of the MprHashEntry class which allows MaSession instances to be stored in a MprHashTable for quick access by their session ID values.


Public Member Functions

 MaSession (MaHost *host, char *sessionId, int timeout)
char * get (char *key)
char * getId ()
void set (char *key, char *value)
int unset (char *key)

Constructor & Destructor Documentation

MaSession::MaSession MaHost host,
char *  sessionId,
int  timeout
 

Synopsis:
Construct a new session data store.
Overview:
Sessions are created and associated with a serving host. The constructor is supplied a unique session ID that will be used as the key for the hash entry for the Session object.
Parameters:
host Pointer to the host object owning the session.
sessionId Pointer to a unique character string session identifier.
timeout Timeout for the session in seconds. If after the timeout has expired and no session activity has occurred, the sesion will be disposed.

Member Function Documentation

char * MaSession::get char *  key  ) 
 

Synopsis:
Get the value of a session data item.
Overview:
Data is stored in key/value pairs.
Parameters:
key Key value to retrieve.
Returns:
Returns a pointer to the value of the key. Do not free.

char* MaSession::getId  )  [inline]
 

Synopsis:
Return the Session ID
Overview:
Return the session ID associated with this session. Session IDs are strings that are unique in the server responding to the request.
Returns:
Returns a pointer to the Session ID string. Do not free.

void MaSession::set char *  key,
char *  value
 

Synopsis:
Update a session value
Overview:
Update the session value for a given key.
Parameters:
key The name of the session data item to update.
value The value of the session data item.

int MaSession::unset char *  key  ) 
 

Synopsis:
Unset a session data item.
Overview:
Unset and undefine a session data item.
Parameters:
key The name of the session data item to update.
Returns:
Returns zero if successful, otherwise a negative MPR error code.

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