rwlogo
HydraExpress 4.6

HydraExpress C++ API Reference Guide


   


Rogue Wave web site:  Home Page  |  Main Documentation Page

rwsf::Servlet Class Reference
[Servlet]

Abstract base class for servlets. More...

#include <rwsf/servlet/Servlet.h>

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

List of all members.

Public Member Functions

virtual ~Servlet ()
virtual void init (const rwsf::ServletConfig &config)=0
virtual rwsf::ServletConfig getServletConfig () const
virtual void service (rwsf::ServletRequest &req, rwsf::ServletResponse &res)=0
virtual std::string getServletInfo () const =0
virtual void destroy ()=0

Detailed Description

rwsf::Servlet is an abstract base class for servlets. A servlet is a small piece of code that executes inside an Agent running on a server. You would typically use one of the derived classes for creating your own servlets. For example:


Constructor & Destructor Documentation

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

Destructor.


Member Function Documentation

virtual void rwsf::Servlet::destroy (  )  [pure virtual]

Pure virtual function. In derived classes, warns the servlet that the Agent has removed the servlet. The destroy() function allows the servlet to perform cleanup tasks and deallocate resources. The Agent does not forward requests to the servlet after calling this function. A servlet should perform all resource deallocation and cleanup tasks in the destroy() method rather than the servlet destructor.

Implemented in rwsf::GenericServlet.

virtual rwsf::ServletConfig rwsf::Servlet::getServletConfig (  )  const [virtual]

Returns the rwsf::ServletConfig object that was used to initialize this servlet. The rwsf::ServletConfig object contains initialization and startup parameters for this servlet.

Reimplemented in rwsf::GenericServlet.

virtual std::string rwsf::Servlet::getServletInfo (  )  const [pure virtual]

Returns a string describing this servlet. By convention, the string typically includes information on the servlet author, version, and copyright.

Implemented in rwsf::GenericServlet.

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

Pure virtual function. In derived classes, 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. A servlet should perform all resource allocation in the init() method.

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 does not receive requests.

Implemented in rwsf::GenericServlet.

virtual void rwsf::Servlet::service ( rwsf::ServletRequest req,
rwsf::ServletResponse res 
) [pure virtual]

Pure virtual function. In derived classes, the Agent calls this method when a request arrives for this servlet. The Agent only forwards requests after calling the init() method. This method may be called by multiple threads, so applications should take care to guard resources that might be shared across multiple threads.

Implemented in rwsf::HttpServlet.


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.