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
CookieEntity Class Reference

Class wrapper for Cookies. Allow you adjust parameters od each http cookie. Used by CookieMiddleware. More...

#include <cookie_entity.h>

Inheritance diagram for CookieEntity:
Inheritance graph
Collaboration diagram for CookieEntity:
Collaboration graph

Public Member Functions

 CookieEntity (const char *value, time_t expires=-1, size_t maxAge_sec=std::string::npos, const char *domain=nullptr, const char *path=nullptr, bool httpOnly=false)
 
void setValue (std::string value) override
 
std::string toString () override
 
std::unique_ptr< Entityclone () override
 
- Public Member Functions inherited from Entity
virtual ~Entity ()=default
 

Detailed Description

Class wrapper for Cookies. Allow you adjust parameters od each http cookie. Used by CookieMiddleware.

Object of this class consist of key-value pair, and some options for it, like date expires, max age, domain, path, option http only

Constructor & Destructor Documentation

CookieEntity::CookieEntity ( const char *  value,
time_t  expires = -1,
size_t  maxAge_sec = std::string::npos,
const char *  domain = nullptr,
const char *  path = nullptr,
bool  httpOnly = false 
)
explicit

Constructs a cookie entity with parameters

Parameters
valuevalue of cookie
expiresthe maximum lifetime of the cookie as time_t
maxAge_secnumber of seconds until the cookie expires.
domainspecifies those hosts to which the cookie will be sent.
pathindicates a URL path that must exist in the requested resource before sending the Cookie header
httpOnlyHTTP-only cookies aren't accessible via JavaScript

Member Function Documentation

std::unique_ptr<Entity> CookieEntity::clone ( )
overridevirtual

Clone itself

Returns
new CookieEntity object

Implements Entity.

void CookieEntity::setValue ( std::string  value)
overridevirtual

Set value of this cookie

Parameters
valueserialized to string value

Implements Entity.

std::string CookieEntity::toString ( )
overridevirtual

Method is used to serialize itself

Returns
serialized string like: "<cookie-value>; Expires=<date>; Max-Age=<non-zero-digit> ..."

Implements Entity.


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