If you want to use a different HTTP adaptor from the one installed by default on your platform, you need to build and install it. This section discusses building HTTP adaptors from the source code in /Developer/Examples/WebObjects/Source/Adaptors.
Before building an adaptor, make sure that you have the following installed:
On platforms other than Mac OS X Server, make sure that you have defined and exported an environment variable called NEXT_ROOT that contains the path to your WebObjects installation (/opt/Apple by default). On Mac OS X Server, this is equivalent to the root (/) directory of your boot volume. With these prerequisites satisfied, use the following steps to build your adaptor:
In case you need to modify the default adaptors, Table 3-3 identifies the purpose of the source files in /Developer/Examples/WebObjects/Source/Adaptors/.
The following sections contain additional details about the specific adaptors, including installation instructions.
A successful build of the Apache adaptor yields a file named mod_WebObjects.so. This file should be copied into /System/Library/WebObjects/Adaptors/Apache on Mac OS X and NEXT_ROOT/Library/WebObjects/Adaptors/Apache on other platforms. In order for the adaptor to work, Apache must be configured to accept Dynamic Shared Objects (DSOs). Refer to the Apache Web server documentation available at http://www.apache.org for more information on building Apache to accept DSOs. If the adaptor fails to build, it is probably because Apache is not built to accept DSOs; rebuild the Apache Web server.
Once you have built the adaptor and server, you need to configure the Web server to handle WebObjects requests. See Customizing HTTP Adaptors for more information on configuring Apache.
After you have built and configured the server with the linked adaptor, you should start it and confirm that it's working by moving aside the WebObjects CGI adaptor in the cgi-bin directory and making a few requests.You can determine whether the CGI or Apache adaptor is handling requests by turning on the logging feature of the adaptor as follows:
Info: <CGI> new request: /cgi-bin/WebObjects/MyApp
Info: <WebObjects Apache Module> new request: /cgi-bin/WebObjects/MyApp
To install the ISAPI adaptor, copy the WebObjects.dll file to your HTTP servers scripts directory. The ISAPI adaptor is loaded into the HTTP server the first time a request of the form http://.../scripts/WebObjects.dll/ is received. It then remains active until the server is stopped.
ISAPI does not provide any specific way to pass information into the adaptor, so the Registry is used. Modifying the Registry should only be done by an experienced Windows 2000 Administrator. To do so, from the Start Menu, choose Run and enter regedit.
The WebObjects adaptor entries are found in the HKEY_LOCAL_MACHINE panel under SOFTWARE\Apple\WebObjects\Configuration. Customizing HTTP Adaptors discusses some of the most common modifications you need to make. In addition the following registry entries are recognized by the ISAPI adaptor:
The values are as described in /Developer/Examples/WebObjects/Source/Adaptors/woadaptor.xml.
To install the iPlanet adaptor copy libWebObjects.so to NEXT_ROOT/Library/WebObjects/Adaptors/NSAPI. To use the adaptor, modify the magnus.conf file to use WebObjects. (By default, this file is in /opt/iplanet/servers/https-hostname/config/magnus.conf.)
At the end of the block of configuration items that are prefixed with Init, add the following two lines:
Init fn="load-modules" funcs="WebObjects_init,WebObjectsNameTrans,WebObjectsRequest" shlib=pathToNSAPIadaptor
Init fn="WebObjects_init" root=pathToWebServer'sDocRoot config=woconfigurl
Set pathToNSAPIadaptor to the path to the NSAPI shared library. This is /opt/Apple/Library/WebObjects/Adaptors/NSAPI/libWebObjects.so on Solaris and C:/Apple/Library/WebObjects/Adaptors/NSAPI/WebObjects.dll on Windows.
Set pathToWebServer'sDocRoot to the path to the document root of your Web server (/opt/iplanet/servers/docs).
Set woconfigurl to the URL used to access wotaskd on the local machine, for example http://localhost:1085.
The default CGI adaptor is a generic CGI adaptor designed to be used with all Web servers that supports CGI. There is a performance disadvantage when using CGI adaptors; therefore, you should consider using a server plug-in adaptor whenever possible.
To install this adaptor, copy the file WebObjects, WebObjects.exe on Windows, to your Web server's cgi-bin or scripts directory. This is done for you if you install WebObjects on to a system with a Web server installed.
In Windows 2000 the CGI adaptor normally contacts the instance of wotaskd on localhost for adaptor configuration information including the list of instances. For deployment you normally want to use a different mechanism that is less expensive. Set up the CGI adaptor to use either a static file on the Web server or a static URL for this information. For examples of this see Customizing HTTP Adaptors.
If there are problems executing the CGI adaptor on MacOS X
Although generally not the best for production level deployment, there is a good reason to use the CGI adaptor. It is useful for exercising the underlying request handler and debugging any customizations you may have made to the source code. Since all input to any CGI program is provided in the environment variables and stdin, the WebObjects CGI program can be conveniently run under a debugger.
To do this, set the following environment variables and values as shown in Table 3-4.
Environment variable | Value |
REQUEST_METHOD | GET |
SERVER_PROTOCOL | HTTP/1.0 |
QUERY_STRING | \?foo=bar |
SCRIPT_NAME | /cgi-bin/WebObjects |
PATH_INFO | /MyApps/MyCoolApp |
If you want to include form data, set a CONTENT_LENGTH header and type the form as stdin. An alternative is to edit execute the TestCGI.sh or Env.csh files provided in /Developer/Examples/WebObjects/Source/Adaptors/CGI.