			README FILE FOR CPP_SERVLET
			===========================

The C++ servlet engine works with Apache Web Server 2.0.40.
It can be made to work with other versions (2.0.xx) of Apache
by recompiling the servlet module with the corresponding 
Apache libraries and headers.

The cpp servlet engine assumes $APACHE_ROOT/cpp_servlet as the web root.
So $APACHE_ROOT should contain a direcotry with the name "cpp_servlet".
The web applications will be deployed under this directory.

To deploy a web application, create a subdirectory under cpp_servlet
with the application name and create a new deployment descriptor (web.xml)
in the new directory.

So if "Shapes" is the web application, then its deployment descriptor's
path will be $APACHE_ROOT/cpp_servlet/Shapes/web.xml

The web.xml contains the following
 a.	Context parameters for the application.

    	<context-param>
      		<param-name>language</param-name>
      		<param-value>Spanish</param-value>
    	</context-param>

 b.	Details about servlets constituting the application (name etc).
      
	<servlet-name>XMLParserServlet</servlet-name>

 c.	Init parameters for the servlets in the application.

      	<init-param>
        	<param-name>xmlFilePath</param-name>
        	<param-value>D:/OrderEntry/AddProductBooks.xml</param-value>
      	</init-param>

 d.	Name of the dll which corresponds to the web application.
 
    	<dll-name>ShapeServlets.dll</dll-name>


The corresponding DLL should be present in the directory $APACHE_ROOT/modules.

To access a deployed cpp servlet, the URL to be typed is
http://SERVERNAME/cpp_servlet/APPLICATION_NAME/SERVLET_NAME

For example, to access the "ShapeServlet" which is a part of the "Shape"
web application, the URL would be http://SERVERNAME/cpp_servlet/Shape/ShapeServlet

If you are adding a servlet to an existing web application (ie, a dll), then
you need to add an entry for the servlet to the web.xml file in the application
directory.

Steps to create your own servlet project on Win32 (systems)
-----------------------------------------------------------

1) Create a new Project using MS Visual Studio C++ version 6.0  of type "Win32 Dynamic-Link Library". (Create the project in dev\src directory under the C++WSP
Installation directory). Choose the kind of DLL as "DLL that exports some symbols".
 Let the default .cpp and .h files with the prefix that is the same as the project name be there. They are required to export a .lib file. Which is used for linking.

3) Add a .h and .cpp file having the servlet declaration and definition. Look at the examples already available under the user_servlets/ directory and under user_servlets/shape_servlet directory. You can add as many servlets and other pieces of source code as you like. 

The user servlets should inherit from the "HttpServlet" class.
In the .cpp file, use the macro REGISTER_SERVLET to register the Servlet to the
ServletFactory. ie. REGISTER_SERVLET(HelloWorldServlet, "HelloWorldServlet")
where "HelloWorldServlet" is the servlet class name.
Implement the doGet and doPost methods for the servlet.

4) Set the Project settings (complile dependences)
  a) Add the include path for cpp_servlet_lib
     e.g. /I "../../include"
  b) Add the library path of the cpp_servlet_lib
     e.g. ../../lib/cpp_servlet_dll.lib
  c) Remove the option /Yu"stdafx.h" from the Project settings->C++ tab.
  d) VERY IMPORTANT - Add the flag /MDd . This is required to allow      std::vector of 			strings being passed and returned by functions.
     (refer to http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q168958& ) 

   
