Provides a way to identify a user across more than one page request or visit to a Web site and to store information about that user.
More...
|
typedef
std::chrono::time_point
< std::chrono::system_clock,
typename
std::chrono::system_clock::duration > | time_type |
| Type to be returned with get_creation_time and get_last_accessed_time.
|
|
typedef _MapType | map_type |
| Type definition for this map implementation.
|
|
typedef map_type::key_type | key_type |
| Container's key type.
|
|
typedef map_type::mapped_type | mapped_type |
| Container's mapped type.
|
|
typedef map_type::value_type | value_type |
| Container's value type: std::pair<const key_type, mapped_type>
|
|
typedef map_type::allocator_type | allocator_type |
| Container's allocator type.
|
|
typedef value_type & | reference |
| value_type&
|
|
typedef const value_type & | const_reference |
| const value_type&
|
|
typedef map_type::pointer | pointer |
| Pointer type to value_type.
|
|
typedef map_type::const_pointer | const_pointer |
| Constant pointer type to value_type.
|
|
typedef map_type::size_type | size_type |
| An unsigned integral type to represent the size of this container.
|
|
typedef map_type::difference_type | difference_type |
| A signed integral type to represent distance between iterators.
|
|
typedef map_type::iterator | iterator |
| Bidirectional iterator type.
|
|
typedef map_type::const_iterator | const_iterator |
| Bidirectional constant iterator type.
|
|
typedef map_type::reverse_iterator | reverse_iterator |
| Reverse iterator type.
|
|
typedef
map_type::const_reverse_iterator | const_reverse_iterator |
| Constant reverse iterator type.
|
|
|
const std::string & | get_id () const |
| Returns a string containing the unique identifier assigned to this session. More...
|
|
time_type | get_creation_time () const |
| Returns the time when this session was created as recorded by std::chrono::system_clock . More...
|
|
time_type | get_last_accessed_time () const |
| Returns the last time the client sent a request associated with this session, as recorded by std::chrono::system_clock , and marked by the time the container received the request. More...
|
|
bool | is_new () const |
| Returns true if the client does not yet know about the session or if the client chooses not to join the session. More...
|
|
void | set_principal (principal *p) |
| Set the authenticated principal that is associated with this session. More...
|
|
void | set_principal (std::shared_ptr< principal > p) |
| Set the authenticated principal that is associated with this session. More...
|
|
void | set_principal (std::unique_ptr< principal > &&p) |
| Set the authenticated principal that is associated with this session. More...
|
|
std::shared_ptr< principal > | get_principal () const |
| Return the authenticated principal that is associated with this session. More...
|
|
| any_map ()=default |
| Constructs an empty container, with no elements.
|
|
template<typename... Args> |
| any_map (Args &&...args) |
| Forwarding constructor. More...
|
|
| ~any_map ()=default |
| Destroys the object.
|
|
template<typename... Args> |
any_map & | operator= (Args &&...args) |
| Forwarding assignment. More...
|
|
template<typename KeyType > |
bool | contains_key (const KeyType &key) const |
| Tests whether value with a given key exists in this container. More...
|
|
template<typename T , typename KeyType > |
optional_ref< const T > | get (const KeyType &key) const |
| Returns optional_ref object to a value with a specified type, if that value exists and can be casted to the requested type. More...
|
|
template<typename T , typename KeyType > |
optional_ref< T > | get (const KeyType &key) |
| Returns optional_ref object to a value with a specified type, if that value exists and can be casted to the requested type. More...
|
|
template<typename T , typename... Args> |
T & | ensure_get (key_type &&key, Args &&...args) |
| Returns reference to a value with a specified type, if that value exists and can be casted to the requested type. More...
|
|
template<typename T , typename... Args> |
T & | ensure_get (const key_type &key, Args &&...args) |
| Returns reference to a value with a specified type, if that value exists and can be casted to the requested type. More...
|
|
template<typename T , typename... Args> |
bool | put (key_type &&key, Args &&...args) |
| Associates a value of specified type created with a given arguments with the specified key in this map. More...
|
|
template<typename T , typename... Args> |
bool | put (const key_type &key, Args &&...args) |
| Associates a value of specified type created with a given arguments with the specified key in this map. More...
|
|
Provides a way to identify a user across more than one page request or visit to a Web site and to store information about that user.
The servlet container uses this interface to create a session between an HTTP client and an HTTP server. The session persists for a specified time period, across more than one connection or page request from the user. A session usually corresponds to one user, who may visit a site many times. The server can maintain a session in many ways such as using cookies or rewriting URLs.
This interface allows servlets to
-
View and manipulate information about a session, such as the session identifier, last accessed time
-
Bind objects to sessions, allowing user information to persist across multiple user connections
A servlet should be able to handle cases in which the client does not choose to join a session, such as when cookies are intentionally turned off. Until the client joins the session, is_new
returns true
. If the client chooses not to join the session, http_request::get_session
will return a different session on each request, and is_new
will always return true
.
Session information is scoped only to the current web application (servlet_context
), so information stored in one context will not be directly visible in another.