ofxHTTP
A collection of tools for HTTP.
ofx::HTTP::AbstractSessionStore Class Referenceabstract

An abstract class representing a session store. More...

#include <AbstractServerTypes.h>

Inheritance diagram for ofx::HTTP::AbstractSessionStore:
ofx::HTTP::BaseSessionStore ofx::HTTP::SimpleSessionStore

Public Member Functions

virtual ~AbstractSessionStore ()
 Destroy the AbstractSessionStore.
 
virtual AbstractSessiongetSession (Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response)=0
 Get a valid session for the given request. More...
 
virtual void destroySession (Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response)=0
 Destroy the session(s) associated with the given exchange. More...
 

Protected Member Functions

virtual bool hasSession (const std::string &sessionId) const =0
 Query if the store has the the given session. More...
 
virtual AbstractSessiongetSession (const std::string &sessionId)=0
 Get a session by sesssionId. More...
 
virtual AbstractSessioncreateSession ()=0
 Create a completely new session. More...
 
virtual void destroySession (const std::string &sessionId)=0
 Destroy the record of a session by its session id. More...
 

Detailed Description

An abstract class representing a session store.

A session store is responsible for establishing browsing sessions. This includes but is not limited to sessions created using HTTP cookies.

Member Function Documentation

◆ createSession()

virtual AbstractSession& ofx::HTTP::AbstractSessionStore::createSession ( )
protectedpure virtual

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.

Returns
A reference to the newly created session.

Implemented in ofx::HTTP::SimpleSessionStore, and ofx::HTTP::BaseSessionStore.

◆ destroySession() [1/2]

virtual void ofx::HTTP::AbstractSessionStore::destroySession ( Poco::Net::HTTPServerRequest &  request,
Poco::Net::HTTPServerResponse &  response 
)
pure virtual

Destroy the session(s) associated with the given exchange.

This method will invalidate any session cookies in the response header. If session data does not exist, the method will return quietly.

Implemented in ofx::HTTP::BaseSessionStore.

◆ destroySession() [2/2]

virtual void ofx::HTTP::AbstractSessionStore::destroySession ( const std::string &  sessionId)
protectedpure virtual

Destroy the record of a session by its session id.

If session data does not exist, the method will return quietly.

Parameters
sessionIdThe id of the session to destroy.

Implemented in ofx::HTTP::SimpleSessionStore, and ofx::HTTP::BaseSessionStore.

◆ getSession() [1/2]

virtual AbstractSession& ofx::HTTP::AbstractSessionStore::getSession ( Poco::Net::HTTPServerRequest &  request,
Poco::Net::HTTPServerResponse &  response 
)
pure virtual

Get a valid session for the given request.

This method is guaranteed to provide a valid session the session created will expire when teh browser window is closed. Other method will be able to update the cookie in the response headers if more speific cookie parameters are desired.

This method will also ensure that only one session id is availble at a given time

Parameters
requestThe HTTP request.
responseThe HTTP response.
Returns
A reference to an AbstractSession.

Implemented in ofx::HTTP::BaseSessionStore.

◆ getSession() [2/2]

virtual AbstractSession& ofx::HTTP::AbstractSessionStore::getSession ( const std::string &  sessionId)
protectedpure virtual

Get a session by sesssionId.

Parameters
sessionIdThe id of the session to get.
Exceptions
Poco::InvalidAccessExceptionif no session is found.

Implemented in ofx::HTTP::SimpleSessionStore, and ofx::HTTP::BaseSessionStore.

◆ hasSession()

virtual bool ofx::HTTP::AbstractSessionStore::hasSession ( const std::string &  sessionId) const
protectedpure virtual

Query if the store has the the given session.

Parameters
sessionIdThe id of the session to query.

Implemented in ofx::HTTP::SimpleSessionStore, and ofx::HTTP::BaseSessionStore.


The documentation for this class was generated from the following file: