Class wrapper for Cookies. Allow you adjust parameters od each http cookie. Used by CookieMiddleware.
More...
#include <cookie_entity.h>
|
| 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< Entity > | clone () override |
|
virtual | ~Entity ()=default |
|
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
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
-
value | value of cookie |
expires | the maximum lifetime of the cookie as time_t |
maxAge_sec | number of seconds until the cookie expires. |
domain | specifies those hosts to which the cookie will be sent. |
path | indicates a URL path that must exist in the requested resource before sending the Cookie header |
httpOnly | HTTP-only cookies aren't accessible via JavaScript |
std::unique_ptr<Entity> CookieEntity::clone |
( |
| ) |
|
|
overridevirtual |
void CookieEntity::setValue |
( |
std::string |
value | ) |
|
|
overridevirtual |
Set value of this cookie
- Parameters
-
value | serialized 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: