Define a different servlet zone for each domain.
<VirtualHost [IP#]>
<IfModule mod_jserv.c>
ApJServDefaultPort 8007
ApJServAction .gsp /servlets/gsp
ApJServMount /servlets /domain1
/IfModule
/VirtualHost
<VirtualHost [IP#]>
<IfModule mod_jserv.c>
ApJServDefaultPort 8007
ApJServAction .gsp /servlets/gsp
ApJServMount /servlets /domain2
/IfModule
/VirtualHost
<IfModule mod_jserv.c>
ApJServManual off
ApJServMountCopy on
ApJServDefaultPort 8007
ApJServProperties /usr/local/apache/etc/jserv.properties
ApJServSecretKey /usr/local/apache/etc/jserv.secret.key
ApJServLogFile /var/log/apache/jserv.log
ApJServMount /share/servlets /share
<Location /status/jserv/>
SetHandler jserv-status
order deny,allow
deny from all
allow from yourdomain.com
/Location
/IfModule
Anything under www.domain1.com/servlets is in zone "domain1" and anything
under www.domain2.com/servlets is in zone "domain2". Each zone has a
separate class loader so each zone has separate servlets. But, the url
anydomain/share/servlets is shared and maps to zone "share", so you can
have a common set of servlets accessible by both virtual hosts, e.g.,
www.domain1.com/share/servlets/emailservlet and
www.domain2.com/share/servlets/emailservlet will both execute the same
servlet. You can carry this further and have anything under /share be
shared among virtual hosts, so www.domain1.com/share/cgi/foocgi and
www.domain2.com/share/cgi/foocgi would run the same cgi script (this is how
I setup my server). |