HydraExpress™ C++ API Reference Guide

Product Documentation:
   HydraExpress C++
Documentation Home
List of all members | Public Member Functions | Protected Member Functions
rwsf::WebServiceServlet Class Reference

Servlet implementation for hosting web services. More...

#include <rwsf/webservice/servlet/WebServiceServlet.h>

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

Public Member Functions

void doGet (rwsf::HttpServletRequest &request, rwsf::HttpServletResponse &response)
 
void doPost (rwsf::HttpServletRequest &request, rwsf::HttpServletResponse &response)
 
- Public Member Functions inherited from rwsf::HttpServlet
virtual ~HttpServlet ()
 
virtual void service (rwsf::ServletRequest &req, rwsf::ServletResponse &resp)
 
- Public Member Functions inherited from rwsf::GenericServlet
 GenericServlet ()
 
virtual ~GenericServlet ()
 
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
 
std::string getServletName () const
 
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
 
- Public Member Functions inherited from rwsf::Servlet
virtual ~Servlet ()
 

Protected Member Functions

virtual void destroy ()
 
virtual void init ()
 
virtual void init (const rwsf::ServletConfig &config)
 
- Protected Member Functions inherited from rwsf::HttpServlet
virtual void doDelete (rwsf::HttpServletRequest &req, rwsf::HttpServletResponse &resp)
 
virtual void doHead (rwsf::HttpServletRequest &req, rwsf::HttpServletResponse &resp)
 
virtual void doOptions (rwsf::HttpServletRequest &req, rwsf::HttpServletResponse &resp)
 
virtual void doPut (rwsf::HttpServletRequest &req, rwsf::HttpServletResponse &resp)
 
virtual void doTrace (rwsf::HttpServletRequest &req, rwsf::HttpServletResponse &resp)
 
virtual rwsf::DateTime getLastModified (rwsf::HttpServletRequest &req) const
 
virtual void service (rwsf::HttpServletRequest &req, rwsf::HttpServletResponse &resp)
 

Detailed Description

This class represents a servlet implementation for exposing RWSF code-generated web services. The servlet is automatically instantiated by the RWSF Agent when the Agent is started, and is based on the web.xml file generated by RWSF for your project. The servlet creates an rwsf::NamingContext context object for each service. This context contains all rwsf::NamedObject objects that are required by the service.

For more information on the use of the servlet to host web services, see the main product user guide and the Web Service Development Guide.

Member Function Documentation

virtual void rwsf::WebServiceServlet::destroy ( )
protectedvirtual

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.

Reimplemented from rwsf::GenericServlet.

void rwsf::WebServiceServlet::doGet ( rwsf::HttpServletRequest request,
rwsf::HttpServletResponse response 
)
virtual

Responds to a request that uses the GET method. Servlets that implement the GET method should override this method. The default implementation returns an rwsf::HttpServletResponse::SC_METHOD_NOT_ALLOWED status code to the client.

Reimplemented from rwsf::HttpServlet.

void rwsf::WebServiceServlet::doPost ( rwsf::HttpServletRequest request,
rwsf::HttpServletResponse response 
)
virtual

Responds to a request that uses the POST method. The POST method is used to send large or unstructured data to the servlet and is very useful when sending XML-encoded data. Servlets that implement the POST method should override this method. The default implementation returns an rwsf::HttpServletResponse::SC_METHOD_NOT_ALLOWED status code to the client.

Reimplemented from rwsf::HttpServlet.

virtual void rwsf::WebServiceServlet::init ( )
protectedvirtual

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.

Reimplemented from rwsf::GenericServlet.

virtual void rwsf::WebServiceServlet::init ( const rwsf::ServletConfig config)
protectedvirtual

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.

Reimplemented from rwsf::GenericServlet.

Copyright © 2020 Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is registered trademark of Rogue Wave Software, Inc. in the United States and other countries, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.