rwsf::GenericServlet rwsf::Servlet
destroy() GenericServlet() getInitParameter() |
getInitParameterNames() getServletConfig() getServletContext() |
getServletInfo() getServletName() init() |
log() ~GenericServlet() |
#include <rwsf/servlet/GenericServlet.h>
rwsf::GenericServlet is an abstract class that contains a basic framework for a C++ servlet. The class implements specific functionality beyond that offered by rwsf::Servlet. For flexibility, a servlet that does not service HTTP requests may derive from rwsf::GenericServlet and override the pure virtual service() function inherited from rwsf::Servlet.
In practice, the HydraExpress Agent serves HTTP requests. Most HydraExpress servlets derive from rwsf::HttpServlet.
GenericServlet();
Default constructor. Creates an uninitialized servlet.
virtual ~GenericServlet();
Destructor.
virtual void destroy();
This method is called by the Agent when this servlet is about to be taken out of service. All cleanup for a servlet should be done in this method rather than in the servlet destructor.
std::string getInitParameter(const std::string& name) const;
Returns the value of the initialization parameter name. Initialization parameters are configured in the deployment descriptor. If the name is not found, returns the empty string. Parameter name comparisons are case-sensitive. To access servlet context initialization parameters use getServletContext().
rwsf::Enumeration<std::string> getInitParameterNames() const;
Returns an enumeration of all the parameter names defined for this servlet in the deployment descriptor. When the deployment descriptor defines no initialization parameters, the enumeration contains no elements. To access servlet context initialization parameter names use getServletContext().
rwsf::ServletConfig getServletConfig() const;
Returns the rwsf::ServletConfig object for this servlet.
rwsf::ServletContext getServletContext() const;
Returns the servlet context for this object. This is a convenience function equivalent to calling getServletConfig().getServletContext().
std::string getServletInfo() const;
Returns information about this servlet. In rwsf::GenericServlet, returns the empty string.
std::string getServletName() const;
Returns the name of this servlet as defined by the servlet-name element of the deployment descriptor.
virtual void init();
Initializes the servlet. After this function returns, the Agent is free to call the service method with requests. All resource allocation for a servlet should be done in this method rather than in the servlet constructor.
A derived class that overrides this function must call the parent init() function. Derived classes should throw rwsf::ServletUnavailableException to indicate failure. If this function throws an exception, the Agent will not place the servlet into service and the servlet will not receive requests. Due to C++ scoping rules, a derived servlet that overrides this method should also override the signature that takes an rwsf::ServletConfig. Only one of the signatures should contain initialization code; the other signature simply forwards to the parent init().
virtual void init(const rwsf::ServletConfig& config);
Initializes the servlet. After this function returns, the Agent is free to call the service method with requests. The config object contains initialization and startup parameters. All resource allocation for a servlet should be done in this method rather than in the servlet constructor.
A derived class that overrides this function must call the parent init() function. Derived classes should throw rwsf::ServletUnavailableException to indicate failure. If this function throws an exception, the Agent will not place the servlet into service and the servlet will not receive requests. Note that, due to C++ scoping rules, the derived servlet should also override the signature that takes no arguments. Only one of the signatures should contain initialization code; the other signature simply forwards to the parent init().
virtual void log(const std::string& message) const;
Writes message to the Agent log file. For more information on logging and how to control the logging output, see the HydraExpress Servlet Development Guide
virtual void log(const std::string& message, const rwsf::Exception& e) const;
Writes message and the string returned by e.why() to the Agent log file. For more information on logging and how to control the logging output see the HydraSCA User's Guide.
©2004-2007 Copyright Quovadx, Inc. All Rights Reserved.
Quovadx and Rogue Wave are registered trademarks of Quovadx, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.