Web framework C++  2.0.0
Simple web framework on c++ designed to easily create web pages, etc
Public Member Functions | List of all members
CookieMiddleware Class Reference

inherited class to parse cookie from http request More...

#include <cookie_middleware.h>

Inheritance diagram for CookieMiddleware:
Inheritance graph
Collaboration diagram for CookieMiddleware:
Collaboration graph

Public Member Functions

 CookieMiddleware (const char *nameID)
 
bool autoExec () override
 
void exec () override
 
void addCookie (const char *key, std::unique_ptr< Entity > value)
 
void insertInResponse ()
 
std::unique_ptr< EntitycreateCookie (CookieEntityFactory::EntityType entityType, std::string &value)
 
void clear () override
 
- Public Member Functions inherited from Middleware
 Middleware (const char *nameID)
 
virtual ~Middleware ()
 
void setContent (Request *request, Response *response)
 
void addValueToMap (const char *key, const char *value)
 
bool getValueFromMap (const char *key, std::string &value)
 
std::unordered_map< std::string, std::string > * getMap ()
 
std::string getNameID ()
 

Additional Inherited Members

- Protected Attributes inherited from Middleware
Requestrequest
 
Responseresponse
 
std::unordered_map< std::string, std::string > * map
 

Detailed Description

inherited class to parse cookie from http request

CookieMiddleware is intended to parse cookie from http request, fill response with cookies

Constructor & Destructor Documentation

CookieMiddleware::CookieMiddleware ( const char *  nameID)
explicit

create middleware

Parameters
nameIDname id

Member Function Documentation

void CookieMiddleware::addCookie ( const char *  key,
std::unique_ptr< Entity value 
)

add CookieEntity to response cookies

Parameters
keykey for entity
valueCookieEntity object
bool CookieMiddleware::autoExec ( )
overridevirtual

Check if there are cookie in request

Returns
true, if there are cookie in request

Implements Middleware.

void CookieMiddleware::clear ( )
overridevirtual

delete all data, saved in internal values, set to default

Reimplemented from Middleware.

std::unique_ptr<Entity> CookieMiddleware::createCookie ( CookieEntityFactory::EntityType  entityType,
std::string &  value 
)

Get new cookie entity with passed type and value

Parameters
entityTypetype from EntityType enumeration
valueserialized value of cookie
Returns
new CookieEntity object
void CookieMiddleware::exec ( )
overridevirtual

parse cookies from http request

Implements Middleware.

void CookieMiddleware::insertInResponse ( )

set response cookies in response headers


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