ofxHTTP
A collection of tools for HTTP.
|
An in-memory session store. More...
#include <SessionStore.h>
Public Member Functions | |
SimpleSessionStore (const std::string &sessionKeyName) | |
Public Member Functions inherited from ofx::HTTP::BaseSessionStore | |
BaseSessionStore (const std::string &sessionKeyName) | |
AbstractSession & | getSession (Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response) |
Get a valid session for the given request. More... | |
void | destroySession (Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response) |
Destroy the session(s) associated with the given exchange. More... | |
Public Member Functions inherited from ofx::HTTP::AbstractSessionStore | |
virtual | ~AbstractSessionStore () |
Destroy the AbstractSessionStore. | |
Protected Types | |
typedef std::map< std::string, std::shared_ptr< AbstractSession > > | SessionMap |
Protected Member Functions | |
SimpleSessionStore (const SimpleSessionStore &) | |
SimpleSessionStore & | operator= (const SimpleSessionStore &) |
bool | hasSession (const std::string &sessionId) const override |
Query if the store has the the given session. More... | |
AbstractSession & | getSession (const std::string &sessionId) override |
Get a session by sesssionId . More... | |
AbstractSession & | createSession () override |
Create a completely new session. More... | |
void | destroySession (const std::string &sessionId) override |
Destroy the record of a session by its session id. More... | |
Protected Attributes | |
SessionMap | _sessionMap |
std::mutex | _mutex |
Protected Attributes inherited from ofx::HTTP::BaseSessionStore | |
const std::string | _sessionKeyName |
Additional Inherited Members | |
Static Public Attributes inherited from ofx::HTTP::BaseSessionStore | |
static const std::string | DEFAULT_SESSION_KEY_NAME = "session_key" |
An in-memory session store.
|
overrideprotectedvirtual |
Create a completely new session.
Since this returns a reference, the newly created session must be stored outside of the local method scope so the reference does not become invalid.
Implements ofx::HTTP::BaseSessionStore.
|
overrideprotectedvirtual |
Destroy the record of a session by its session id.
If session data does not exist, the method will return quietly.
sessionId | The id of the session to destroy. |
Implements ofx::HTTP::BaseSessionStore.
|
overrideprotectedvirtual |
Get a session by sesssionId
.
sessionId | The id of the session to get. |
Poco::InvalidAccessException | if no session is found. |
Implements ofx::HTTP::BaseSessionStore.
|
overrideprotectedvirtual |
Query if the store has the the given session.
sessionId | The id of the session to query. |
Implements ofx::HTTP::BaseSessionStore.