Stores HTTP sessions and deletes them when they have expired. More...
#include <httpsessionstore.h>
Public Member Functions | |
HttpSessionStore (QSettings *settings, QObject *parent) | |
Constructor. | |
virtual | ~HttpSessionStore () |
Destructor. | |
QByteArray | getSessionId (HttpRequest &request, HttpResponse &response) |
Get the ID of the current HTTP session, if it is valid. | |
HttpSession | getSession (HttpRequest &request, HttpResponse &response, bool allowCreate=true) |
Get the session of a HTTP request, eventually create a new one. | |
HttpSession | getSession (const QByteArray id) |
Get a HTTP session by it's ID number. | |
void | removeSession (HttpSession session) |
Delete a session. |
Stores HTTP sessions and deletes them when they have expired.
The following configuration settings are required in the config file:
expirationTime=3600000 cookieName=sessionid
The following additional configurations settings are optionally:
cookiePath=/ cookieComment=Session ID cookieDomain=stefanfrings.de
Definition at line 32 of file httpsessionstore.h.
HttpSessionStore::HttpSessionStore | ( | QSettings * | settings, | |
QObject * | parent | |||
) |
Constructor.
Definition at line 10 of file httpsessionstore.cpp.
HttpSession HttpSessionStore::getSession | ( | HttpRequest & | request, | |
HttpResponse & | response, | |||
bool | allowCreate = true | |||
) |
Get the session of a HTTP request, eventually create a new one.
This method is thread safe. New sessions can only be created before the first byte has been written to the HTTP response.
request | Used to get the session cookie | |
response | Used to get and set the new session cookie | |
allowCreate | can be set to false, to disable the automatic creation of a new session. |
Definition at line 46 of file httpsessionstore.cpp.
HttpSession HttpSessionStore::getSession | ( | const QByteArray | id | ) |
Get a HTTP session by it's ID number.
This method is thread safe.
id | ID number of the session |
Definition at line 75 of file httpsessionstore.cpp.
QByteArray HttpSessionStore::getSessionId | ( | HttpRequest & | request, | |
HttpResponse & | response | |||
) |
Get the ID of the current HTTP session, if it is valid.
This method is thread safe.
request | Used to get the session cookie | |
response | Used to get and set the new session cookie |
Definition at line 26 of file httpsessionstore.cpp.