Servlet Development Guide : PART III Programming : Chapter 9 Creating Servlets : Deploying Servlets
Deploying Servlets
At runtime, the Agent needs to access
The servlet’s deployment descriptor (also called “servlet configuration”) web.xml file
The servlet, filter and listener libraries
The Deployment Descriptor File, web.xml
For the SessionExample servlet in the examples directory, the web.xml file contains the following configuration:
 
<servlet>
<servlet-name>SessionExample</servlet-name>
<servlet-class>rwsf_servlet_example.createSessionExample</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SessionExample</servlet-name>
<url-pattern>/SessionExample/*</url-pattern>
</servlet-mapping>
This file must be deployed to the context directory so it is accessible to the Agent at runtime. The Agent’s default deployment settings assume <installdir>\apps\servlets\<servicecontextname> for a servlet’s web.xml file. You can change this default location if you wish, discussed in “Changing the Default Deployment Directories” .
The Servlet, Filter, and Listener Libraries
The files that hold the compiled servlets, filters, and listeners must be located in the path the Agent uses for runtime library loading. The setup script rwsfvars provided with HydraExpress adds <installdir>/lib and <installdir>/apps-lib directories (for UNIX or Linux), or the <installdir>\bin and <installdir>\apps-bin directories (for Windows) to the appropriate environment variable. The Agent loads compiled objects in these directories with no additional configuration.
The makefiles for the servlet examples are designed to deploy to the apps or lib directories, as follows:
Table 3 – Location of deployed files
System
Deployment Directory
Deployed Files
Windows
<installdir>/lib
For release builds: <servletName>12d.dll
For debug builds: <servletName>15d.dll
UNIX/Linux
<installdir>\bin
For release builds: <servletName>12d.so
For debug builds: <servletName>15d.so
To install the compiled object files, copy the files to a directory specified in the runtime library loading path.
For all HydraExpress servlet examples, the example makefiles copy the compiled library to <installdir>/lib for UNIX/Linux, and to <installdir>\bin on Windows platforms.
NOTE >> The Web services examples located in <installdir>\examples\webservices instead deploy by default to <installdir>/apps-lib for UNIX or Linux, and to <installdir>\apps-bin for Windows.
If you wish to change the location of the libraries, you can edit the provided examples makefile, but then must ensure that the location is in your system’s PATH environment variable. See “Environment Variables” .
For more information on the deployed libraries, see “Installing the Compiled Object Files.”
Changing the Default Deployment Directories
The location of the web.xml deployment directory is defined in the Agent configuration file rwagent.xml, specified by the value of the rwsf:webappsDir property, like so:
 
<rwsf:agent>
...
<rwsf:handler-chain name="http">
<rwsf:handler name="httpServer"
...
<rwsf:property name="rwsf:webappsDir"
value="${RWSF_HOME}/apps/servlets"/>
...
</rwsf:handler>
</rwsf:handler-chain>
...
</rwsf:agent>
If you wish to change where you deploy a servlet’s web.xml, change the value in the rwagent.xml file.
NOTE >> Be aware that if you change the default location of the deployment directory in rwagent.xml, any Web service projects that are generated using the HydraExpress code generator will not deploy correctly without edits to the project-level generated makefile. Code generation is not discussed in this guide, nor used in servlet development; instead, see the HydraExpress Web Service Development Guide.