|
The Apache WebserverThe Apache webserver is currently the most popular webserver package (16871744 websites, Feb 2001) on the Internet and is available for most operating systems and hardware platforms.
Source : Netcraft Apache fully supports the Java Servet 2.0 API, via a subsidiary package called the JServ, which is configured and installed alongside the main Apache server. Unfortunately it is beyond the scope of this document to describe the installation process. Assuming that you have a fully working installation of Apache and the JServ, it is a very simple process to install a new servlet for use with apache. For a basic servlet, which does not require startup parameters, all that is required is to copy the .class file(s) into the 'servlets' directory of the webserver. The servlet can then be accessed with a URL in the form of 'http://www.myhost.com/servlets/myservlet'. Initialisation Arguments When using the servlet runner, initialisation arguments for the servlet were placed in a file called 'servlet.properties'. These arguments can be transfered and used in the apache configuration with no changes. The arguments for all the servlets on a single webserver are usually kept in a single file, with a name 'servlets.properties' or 'zone.properties'. This file is likely to be located either in the main apache installation or as part of the JServ installation if this is separate from apache. An example of such a file can be downloaded here. This file contains the configuration for the demonstration servlets used in this tutorial. As well as the standard parameters defining servlet starting parameters, Apache can also be made to set up aliases for servlets, so that a long package name can be shortened to something shorter and more memorable, eg :
In this example the servlet 'search.SearchServlet' has been aliased to 'search'. This means that the servlet can now be called with 'http://www.myhost.com/servlets/search' instead of 'http://www.myhost.com/servlets/search.SearchServlet'. This should be sufficient to get most servlets working under Apache. Note : Some of the file/directory names may be different for your apache installation. I have tried to stick to the defaults where possible.
| ||||||
|
Tims Home Page | Page last modified : 11 August 2006 | |||||||