HydraExpress Components : Servlet Development Guide : PART I Introduction : Introduction to Servlet Programming
Introduction to Servlet Programming
The servlet interface is designed to make creating Web applications an easy and intuitive process. This chapter explains the process of creating a servlet and presents the code for a simple servlet.
The servlet described in this section is included in the files HelloWorldExample.h and HelloWorldExample.cpp in the examples\servlet directory of the HydraExpress installation. The servlet itself is available at http://localhost:8090/examples/HelloWorldExample on a system running HydraExpress.
Creating and deploying a servlet involves the following steps:
*Create a class that inherits from rwsf::HttpServlet. This class provides the basic framework for a C++ servlet (Deriving from rwsf::HttpServlet)
*Define the servlet by using the RWSF_DEFINE_SERVLET macro within a single source file (Defining the Servlet)
*Implement the request handlers (Implementing Request Handlers)
*Compile the servlet into a shared library (Compiling the Servlet)
*Copy the shared library into the path that the system uses to load shared libraries (Installing the Compiled Object Files)
*Add the servlet deployment descriptor to the web.xml file in the servlet context (Adding the Servlet to the web.xml file)
*If the servlet resides in a new context, configure any external Web servers to forward requests to the new context. Forward Requests From a Web Server describes the process of reconfiguring the Web server.
*Stop and restart the HydraExpress Agent (Stopping and Starting the Agent, and Executing the Servlet).