tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Colin Wilson-Salt <co...@london.virgin.net>
Subject iPlanet / WARP / Tomcat integration
Date Mon, 03 Sep 2001 09:04:22 GMT
Guys.

I've knocked up my first attempt at an iPlanet / Tomcat + WARP integration.

I've sent the C code as an attachment to this message. I hope that's an ok
thing to do.

It's in the form of three functions to be called from obj.conf. There is an
Init function that reads in a configuration file, a NameTrans function that
picks out requests that should be handled by Tomcat, and a Service function
that actually does the business.

A lot of the work was just translating the mod_webapp stuff into Netscape
speak. I haven't had to touch any of the stuff that sits below mod_webapp,
such as the connector stuff, or the definitions of servers, applications
etc.

I have also included a little plugin in the same file that will show
information about the request, parameters, headers, POST data etc. This is
very useful for getting things right before adding them into the main code.
For example, I used this to work out what to do with POST data.

To configure iPlanet to use this stuff, these lines need to be added in the
usual places:


Init fn="load-modules" shlib="/path/to/libwebapp.so"
funcs="init-webapp,nametrans-ebapp,service-webapp,snoop"
Init fn="init-webapp" config="/path/to/webapp.config" verbose="true"

NameTrans fn="assign-name" from="/snoop" name="snoop"
NameTrans fn="nametrans-webapp"

<Object name="snoop">
Service fn="snoop"
</Object>

<Object name="webapp">
Service fn="service-webapp"
</Object>


The webapp.config file looks just like the directives that you would put in
Apache's httpd.conf:

WebAppConnection conn warp localhost:8008
WebAppDeploy examples conn /examples
WebAppInfo /webapp-info

It was a lot simpler to put this into a separate file and have one Init
function than try and put these directives in obj.conf.

Here's my disclaimer: This code is nowhere near ready for prime time. There
is virtually no error checking, it probably leaks like a sieve, the config
file reading code has only been tested on the simplest cases, in fact, I
wouldn't trust the code as anything but an example that it is possible to
get iPlanet and webapp / WARP / Tomcat working together.


Here is my to do list:


1. Virtual Servers:

At the moment this is totally kludged, with no support for any virtual
servers. But does anyone actually use virtual servers with iPlanet?

For Hardware Virtual Servers, iPlanet adds:
NameTrans fn="document-root" address="123.123.123.123" root="/data"

For Software Virtual Servers, iPlanet adds:
<Client urlhost="www.foo.com">
NameTrans fn="home-page" path="/foo.html"
</Client>

To do hardware servers properly, you create a new server instance.

This implies that I'm going to have to create my own information about
virtual servers, and look at host headers etc during my NameTrans stage.

Or I could just not bother.


2. Register Shutdown Calls - so that I don't get leaks etc.


3. Sort out Makefile - so that I can be part of the same build process, and
so I don't drag in the entire APR.


4. Sort out return codes for the low level functions, such as
wam_handler_read and wam_handler_write, so that errors are handled properly.


5. Decide what to do about all the APR calls. Much of this stuff,
particularly the memory allocation stuff, duplicates stuff that is already
supplied by iPlanet.

It would be nice to get the stuff I've done to only use Netscape stuff, so
that it can be maintained by people who know NSAPI but don't know Apache. As
for the shared stuff, perhaps it would be possible to create a common API,
and link to different objects, so the Apache version uses APR, but the
Netscape verson uses the NSAPI stuff. NSAPI includes network / socket
functions and memory allocation stuff - most of what APR seems to be used
for here.


Mime
View raw message