mod_servlet
C++Servlets
 All Classes Files Functions Variables Typedefs Macros Pages
servlet::servlet_config Class Referenceabstract

A servlet configuration object used by a servlet container to pass information to a servlet during initialization. More...

#include <context.h>

Public Member Functions

 servlet_config (const std::string &servlet_name)
 Creates new servlet_config object with a given servlet name. More...
 
 servlet_config (std::string &&servlet_name)
 Move version of the object constructor. More...
 
virtual ~servlet_config () noexcept=default
 Destructor.
 
const std::string & get_servlet_name () const
 Returns the name of this servlet instance. More...
 
virtual const servlet_contextget_servlet_context () const =0
 Returns a reference to the servlet_context in which the caller is executing. More...
 
template<typename KeyType >
optional_ref< const std::string > get_init_parameter (const KeyType &key) const
 Returns a std::string containing the value of the named initialization parameter, or empty_reference if the parameter does not exist. More...
 
const std::map< std::string,
std::string, std::less<> > & 
get_init_parameters () const
 Returns all the servlet's initialization parameters as a tree_map. More...
 

Protected Attributes

const std::string _servlet_name
 Servlet name.
 

Detailed Description

A servlet configuration object used by a servlet container to pass information to a servlet during initialization.

Constructor & Destructor Documentation

servlet::servlet_config::servlet_config ( const std::string &  servlet_name)
inline

Creates new servlet_config object with a given servlet name.

Parameters
servlet_namethe name of the servlet.
servlet::servlet_config::servlet_config ( std::string &&  servlet_name)
inline

Move version of the object constructor.

Parameters
servlet_namethe name of the servlet
See Also
servlet_config(const std::string &)

Member Function Documentation

template<typename KeyType >
optional_ref<const std::string> servlet::servlet_config::get_init_parameter ( const KeyType &  key) const
inline

Returns a std::string containing the value of the named initialization parameter, or empty_reference if the parameter does not exist.

Parameters
keya string specifying the name of the initialization parameter
Returns
a reference to a std::string containing the value of the initialization parameter
const std::map<std::string, std::string, std::less<> >& servlet::servlet_config::get_init_parameters ( ) const
inline

Returns all the servlet's initialization parameters as a tree_map.

Returns
a tree_map of all the servlet's initialization parameters
virtual const servlet_context& servlet::servlet_config::get_servlet_context ( ) const
pure virtual

Returns a reference to the servlet_context in which the caller is executing.

Returns
a servlet_context object, used by the caller to interact with its servlet container
See Also
servlet_context
const std::string& servlet::servlet_config::get_servlet_name ( ) const
inline

Returns the name of this servlet instance.

The name may be provided via server administration, assigned in the web application deployment descriptor, or for an unregistered (and thus unnamed) servlet instance it will be the servlet's class name.

Returns
the name of the servlet instance

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