You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Arieh Markel <Ar...@Central.Sun.COM> on 1999/12/23 16:42:38 UTC
Runtime processing of config files (was Re: setting config file for web application)
> Mailing-List: contact general-help@jakarta.apache.org; run by ezmlm
> X-No-Archive: yes
> list-help: <ma...@jakarta.apache.org>
> list-unsubscribe: <ma...@jakarta.apache.org>
> list-post: <ma...@jakarta.apache.org>
> Delivered-To: mailing list general@jakarta.apache.org
> X-Sender: ari@shell1.shore.net
> To: general@jakarta.apache.org
> From: Ari Halberstadt <ar...@shore.net>
> Subject: Re: setting config file for web application
>
> Craig wrote:
> >Ari Halberstadt wrote:
> >
> >> How can you specify a config file for a web application without messing
> >> with the web application's web.xml file? There's the WEB-INF/web.xml file,
> >>...
> >
> >A big piece of the thinking behind web applications, and the "web.xml"
> >deployment descriptor, is to make the web application as independent of the
> >environment it runs in as possible. The result of this line of thinking was
> >that *everything* (except the context path) is specified in the web.xml file.
> >Providing a mechanism to access a path to a properties file, as you suggest,
> >would create a dependency on the external environment that is not currently
> >present.
>
> Except that this line of thinking doesn't work in the real world. It's nice
> to have a config file that specifies constant things, like the name of the
> application. But there are also variable parameters, e.g., database
> connection parameters, whose specific values have nothing whatsoever to do
> with the application and which cannot be predicted in advance. The whole
> point of parameters is to allow runtime parameterization, if they could be
> coded as constants in the code there would be no need for the parameters.
> Tomcat (and the servlet spec) really needs a way to specify additional
> variable properties without requiring people to muck around with the
> application's web.xml file.
>
> >
> >The servlet 2.2 API spec requires that the "web.xml" file be found in the
> >WEB-INF directory. If you want to support alternative configuration files,
> >one approach would be to use a startup script for your servlet container that
> >copied different "web.xml" files depending on command line options into the
> >official place. I've had to play this kind of game in environments where I
> >have separate development and production servers, to set the correct database
> >connection parameters based on which environment I am running in.
>
> This feels like a kludge. I want to distribute a constant set of sources
> and let people specify their own configuration in an independent location.
> As another example, let's say I have 10 virtual hosts, each of which is
> provided with its own database. I only want to keep one copy of the
> application around, and the various source files (.java, .jsp, etc.) can
> easily be shared among all of the virtual hosts. The only things that need
> to vary are the parameters for each host. I don't see how to do this with
> the current web.xml scheme.
The Java application on which I am embedding Tomcat exposes such a problem.
The application runs as a daemon on which components are deployed dynamically
at run-time. These components may come and go, and may be contributed by
other parts of our organization just as well as they may be contributed
by third parties.
We find the need to have a mechanism that allows for decentralization of
the 'management' of the contributions from all sides that operate under the
application. Removing the need for the application framework (the platform)
from serving as an arbitrator is a must for us.
In the application the appearance of components, trigger events that perform
their incorporation to the running application.
In the context of Jakarta/Tomcat, the incorporation needs to allow for
assimilation and processing of their corresponding web.xml information.
The default mechanism does not provide the direct hooks to perform that.
In its absence I have begun designing and implementing my own mechanism
for incorporation of web.xml componentry/information to the system.
It would have been nice if the API allowed run-time deployment of new components.
Is such a mechanism something in the plans for Jakarta/Tomcat ?
Arieh
>
> I think server.dtd needs an additional attribute to specify the location of
> a config file for a context. Then we'd have to decide what is allowed in
> that file (I'd suggest making it just like web.xml) and how its data are
> combined with the web.xml file distributed with the application.
>
> -- Ari Halberstadt mailto:ari@shore.net <http://www.magiccookie.com/>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: general-help@jakarta.apache.org
--
Arieh Markel Sun Microsystems Inc.
Network Storage 500 Eldorado Blvd. MS UBRM11-194
e-mail: arieh.markel@sun.COM Broomfield, CO 80021
Let's go Panthers !!!! Phone: (303) 272-8547 x78547
(e-mail me with subject SEND PUBLIC KEY to get public key)
Re: Runtime processing of config files (was Re: setting config file for web application)
Posted by Brill Pappin <br...@jmonkey.com>.
> In the application the appearance of components, trigger events that
perform
> their incorporation to the running application.
> In the context of Jakarta/Tomcat, the incorporation needs to allow for
> assimilation and processing of their corresponding web.xml information.
>
> The default mechanism does not provide the direct hooks to perform that.
>
> In its absence I have begun designing and implementing my own mechanism
> for incorporation of web.xml componentry/information to the system.
>
> It would have been nice if the API allowed run-time deployment of new
components.
>
> Is such a mechanism something in the plans for Jakarta/Tomcat ?
This sounds like a good use of JNDI...
Maybe rebuilding the servlet invoker so that it can use such an interface
would solve your problem, and would go a long way for the rest of us as
well...
Servlets could be stored *anywhere* and used as needed by any engine that
had access to the data store.
It would also allow that association of differing environments something
like what you are looking for.
- Brill Pappin
www.jmonkey.com