HttpServlet¶
-
class
cppmicroservices::HttpServlet¶ Inherits from std::enable_shared_from_this< HttpServlet >
Subclassed by cppmicroservices::AbstractWebConsolePlugin
Public Functions
-
HttpServlet()¶
-
virtual void
Init(ServletConfig const &config)¶ Called by the servlet container to indicate to a servlet that the servlet is being placed into service.
The servlet container calls the
Initmethod exactly once after instantiating the servlet. TheInitmethod must complete successfully before the servlet can receive any requests.The servlet container cannot place the servlet into service if the
Initmethod- Throws a
ServletException - Does not return within a time period defined by the Web server
- See
- UnavailableException
- See
- GetServletConfig
- Parameters
config: aServletConfigobject containing the servlet’s configuration and initialization parameters
- Exceptions
ServletException: if an exception has occurred that interferes with the servlet’s normal operation
- Throws a
-
virtual void
Destroy()¶ Called by the servlet container to indicate to a servlet that the servlet is being taken out of service.
This method is only called once all threads within the servlet’s
servicemethod have exited or after a timeout period has passed. After the servlet container calls this method, it will not call theservicemethod again on this servlet.This method gives the servlet an opportunity to clean up any resources that are being held (for example, memory, file handles, threads) and make sure that any persistent state is synchronized with the servlet’s current state in memory.
-
ServletConfig
GetServletConfig() const¶ Returns a ServletConfig object, which contains initialization and startup parameters for this servlet.
The
ServletConfigobject returned is the one passed to theInitmethod.- Return
- the
ServletConfigobject that initializes this servlet - See
- Init
-
virtual void
Service(HttpServletRequest &request, HttpServletResponse &response)¶
-
std::shared_ptr<ServletContext>
GetServletContext() const¶
-
virtual
~HttpServlet()¶
Public Static Attributes
-
const std::string
PROP_CONTEXT_ROOT¶
Protected Functions
-
virtual long long
GetLastModified(HttpServletRequest &request)¶
-
virtual void
DoGet(HttpServletRequest &request, HttpServletResponse &response)¶
-
virtual void
DoHead(HttpServletRequest &request, HttpServletResponse &response)¶
-
virtual void
DoDelete(HttpServletRequest &request, HttpServletResponse &response)¶
-
virtual void
DoPost(HttpServletRequest &request, HttpServletResponse &response)¶
-
virtual void
DoPut(HttpServletRequest &request, HttpServletResponse &response)¶
-
virtual void
DoTrace(HttpServletRequest &request, HttpServletResponse &response)¶
-
std::unique_lock<std::mutex>
Lock() const¶
-