rwsf::WebServiceServletrwsf::HttpServlet
#include rwsf/webservice/servlet/WebServiceServlet.h
The class rwsf::WebServiceServlet is the class from which all servlets in HydraExpress are derived. The servlet is automatically instantiated by the rwsf server when the server is started, and is based on the web.xml file generated by HydraExpress for your project. The servlet creates a 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 servlet, see Section 8.3.11.2, "Servlet Configuration File: web.xml," in the HydraExpress Web Service Development Guide.
We recommend using the servlet automatically instantiated by the rwsf server, but if you choose to create or customize your own servlet, be sure to change its name in the context's web.xml file.
void doGet(rwsf::HttpServletRequest & request, rwsf::HttpServletResponse & response);
Reimplements method in rwsf::HttpServlet
Base class documentation:
Responds to a request that uses the GET method. Servlets that implement the GET method should override this function. The default implementation returns a METHOD_NOT_ALLOWED status code to the client.
Implementation documentation:
Locates and reads the WSDL file in the context directory, and sets the payload, or the contents, of the response. If the WSDL is not found, throws a rwsf::Exception. This method is called by a listener managed by the rwsf server.
void doPost(rwsf::HttpServletRequest & request, rwsf::HttpServletResponse & response);
Reimplements method in rwsf::HttpServlet
Base class documentation:
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 function. The default implementation returns a METHOD_NOT_ALLOWED status code to the client.
Implementation documentation:
Creates the rwsf::ServletContextcontext object for this service and generates a session ID, rwsf:SessionID. Iterates through the header to retrieve the request or response, and the transport data. Calls the method initContext() to initialize the context, and then calls invoke() on the service handler. Finally, calls processContext(), which is implemented in the generated derived class. This method is called by a listener managed by the rwsf server.
void initContext(rwsf::CallInfo & context, rwsf::HttpServletRequest & request);
Virtual. Allows a derived class to add any additional initialization parameters or attributes to the rwsf::CallInfo object before calling the message handler.
void processContext(rwsf::CallInfo & context, rwsf::HttpServletRequest & request, rwsf::HttpServletResponse & response);
Virtual. In derived classes, would provide a hook for accessing the rwsf::CallInfo, rwsf::HttpServletRequest and rwsf::HttpServletResponse parameters after the message handler has been called. Can be used to set additional information in the rwsf::HttpServletResponse.
void destroy();
Reimplements method in rwsf::GenericServlet
Base class documentation:
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.
Implementation documentation:
Destroys all the rwsf::NamedObjects, including the listeners, related to this servlet.
void init();
Reimplements method in rwsf::GenericServlet
Base class documentation:
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().
Implementation documentation:
Initializes a generic servlet with no configuration parameters.
void init(const rwsf::ServletConfig & config);
Reimplements method in rwsf::GenericServlet
Base class documentation:
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().
Implementation documentation:
Initializes the servlet given the parameters in the config object. Uses rwsf::HandlerManager to locate all service handlers for this service, and reads the transports configuration file transports.xml to get the right transport. Initializes the related rwsf::NamedObject objects.
© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.