I'm in the process of moving a slew of servlets from Apache Jserv to Tomcat
+ mod_jk + Apache.
I've managed to get most everything working, accept one little annoying
thing.

Using JServ, initArgs could be specified per zone and per servlet in a JServ
zone config file like so:
servlet.MyServlet.initArgs=props=/path/to/conf/props.properties

and the same can be done on Tomcat in a webapps web.xml file, like so:
<servlet>
        <servlet-name>MyServlet</servlet-name>
        <servlet-class>MyServlet</servlet-class>
        <init-param>
            <param-name>props</param-name>
            <param-value/path/to/conf/props.properties</param-value>
        </init-param>
</servlet>

There were multiple zones, set to work off of the same code repository
(/path/to/java), so you could have virtual hosts (virta.mysite.dom and
virtb.mysite.dom), that would mount their own jserv zones in the Apache
config:
<VirtualHost *>
        ServerName virta.mysite.dom
        ApJservMount /servlet balance://jserv/virta
</VirtualHost>

and

<VirtualHost *>
        ServerName virtb.mysite.dom
        ApJservMount /servlet balance://jserv/virtb
</VirtualHost>

ApJservMount works like JkMount, except that nice little feature at the end
of the ApJservMount directive allows you to specify what zone the mount is
affiliated with, and thus properties files and the initArgs mentioned above.

>From what I've surmised I have 2 options:
1) Configure Tomcat into having multiple webapps/hosts/contexts (sorry, not
sure what to call them yet, I'm that new to Tomcat, sadly) that run off the
same docBase, so that I can have multiple web.xml files that are read just
to specify one measly <init-param>, the location of the virtual
host-specific property file, or

2) Use a ResourceBundle or PropertyResourceBundle to load property files
based on the virtual host, a lot like localization, knowing that this
requires rewriting a bunch of code, something I wanted to avoid. Should I be
using a Filter in Tomcat to achieve this?

I'm looking for the path of least resistance here, so I guess I'm asking, is
there a way to specify an init-param in for a servlet in Tomcat, based on
the host name, without creating multiple webapps, redundant code
repositories, etc?

Thanks mucho,
Corey



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to