rwlogo
HydraExpress 4.6

HydraExpress C++ API Reference Guide


   


Rogue Wave web site:  Home Page  |  Main Documentation Page

rwsf::GenericServlet Class Reference
[Servlet]

Extends rwsf::Servlet to define additional generic servlet functionality. More...

#include <rwsf/servlet/GenericServlet.h>

Inheritance diagram for rwsf::GenericServlet:
rwsf::Servlet rwsf::HttpServlet rwsf::WebServiceServlet

List of all members.

Public Member Functions

 GenericServlet ()
virtual ~GenericServlet ()
virtual void destroy ()
std::string getInitParameter (const std::string &name) const
rwsf::Enumeration< std::string > getInitParameterNames () const
rwsf::ServletConfig getServletConfig () const
rwsf::ServletContext getServletContext () const
std::string getServletInfo () const
virtual void init (const rwsf::ServletConfig &config)
virtual void init ()
virtual void log (const std::string &message) const
virtual void log (const std::string &message, const rwsf::Exception &e) const
virtual void log (rwsf::Logger::LogLevel lvl, const std::string &message) const
virtual void log (rwsf::Logger::LogLevel lvl, const std::string &message, const rwsf::Exception &t) const
std::string getServletName () const

Detailed Description

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 services HTTP requests. Most HydraExpress servlets derive from rwsf::HttpServlet.


Constructor & Destructor Documentation

rwsf::GenericServlet::GenericServlet (  ) 

Default constructor. Creates an uninitialized servlet.

virtual rwsf::GenericServlet::~GenericServlet (  )  [virtual]

Destructor.


Member Function Documentation

virtual void rwsf::GenericServlet::destroy (  )  [virtual]

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.

Implements rwsf::Servlet.

std::string rwsf::GenericServlet::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> rwsf::GenericServlet::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 rwsf::GenericServlet::getServletConfig (  )  const [virtual]

Returns the rwsf::ServletConfig object for this servlet.

Reimplemented from rwsf::Servlet.

rwsf::ServletContext rwsf::GenericServlet::getServletContext (  )  const

Returns the servlet context for this object.

std::string rwsf::GenericServlet::getServletInfo (  )  const [virtual]

Returns information about this servlet. In rwsf::GenericServlet, returns the empty string.

Implements rwsf::Servlet.

std::string rwsf::GenericServlet::getServletName (  )  const

Returns the name of this servlet as defined by the servlet-name element of the deployment descriptor.

virtual void rwsf::GenericServlet::init (  )  [virtual]

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 does not place the servlet into service and the servlet cannot 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() method.

virtual void rwsf::GenericServlet::init ( const rwsf::ServletConfig config  )  [virtual]

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 does not place the servlet into service and the servlet cannot receive requests. 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() method.

Implements rwsf::Servlet.

virtual void rwsf::GenericServlet::log ( rwsf::Logger::LogLevel  lvl,
const std::string &  message,
const rwsf::Exception t 
) const [virtual]
See also:
Logger::LogLevel

Writes message and the string returned by e.why() to the Agent log file, at the specified log level. For more information on logging and how to control the logging output see the User Guide.

virtual void rwsf::GenericServlet::log ( rwsf::Logger::LogLevel  lvl,
const std::string &  message 
) const [virtual]
See also:
Logger::LogLevel

Writes message to the Agent log file at the specified log level. For more information on logging see the User Guide.

virtual void rwsf::GenericServlet::log ( const std::string &  message,
const rwsf::Exception e 
) const [virtual]

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 User Guide.

virtual void rwsf::GenericServlet::log ( const std::string &  message  )  const [virtual]

Writes message to the Agent log file. For more information on logging and how to control the logging output, see the User Guide.


Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo are registered trademarks of Rogue Wave Software, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.