I've handled this kinda thing using an LDAP directory (in my case, Novell
eDirectory - but iPlanet or OpenLDAP would work). This avoids having to do
anything with WAR's or JAR's. So, for my stuff, I've basically extended
the directory schema to provide the attributes that I need and then use the JNDI
interface to access the config data. The advantages for me are:
- Each user can have their own set of configuration data.
- You could also have a whole bunch of users inherit this config data from
the container in which they reside (this mught be useful for default config info
where the user hasn't customised their own information)
- It's secure, fast and scalable (HTTPS etc etc.)
Of course, it depends on your apps requirements for deployment, scalilibity
and all that good stuff. Fortunately, you can get free directory products
and this may make sense for you.
Best of luck.
Cheers Steve.
>>> [EMAIL PROTECTED] 19/11/2001 17:22:51 >>> Greetings... I've been trying to figure out a good, simple way to store configuration data associated with web applications stored in WARs. The goal is something that is easy to deploy (via WAR) and maintain. I would like to be able to deploy a new WAR without touching the config info. That way, the container can handle the WAR automatically and the config data is only touched when it needs to be changed. The options I have considered include: - Store any config data in a DB and access using JDBC. Two problems: Setting up the DB takes time, and (more importantly) the connect string and driver info still needs to be stored somewhere. - Store the config file in <webapp>/WEB-INF. The problem with this is that it can be overwritten when a new WAR is deployed. - Store the config file in the directory pointed to by System.getProperty("user.home"). This concerns me because that is based on the user. - Use an absolute path to store the config file. The problem with this is that different systems are different, especially across different platforms. So the "absolute" path varies from system to system, and must be specified in another way. - Use a system property (-Dconfig.dir) to specify where the config files are. The problem here is that different servlet containers need to be set up differently to set the system property. - Use an InitServlet, with an init-param, to load the config into the ServletContext. Problem is, the web.xml file needs to be updated everytime the WAR is deployed. The way I am leaning right now is to use the user.home property. The following procedure would be used: - When a servlet inits, it trys to find the config file in user.home. - If the file is not there, a warning is logged and a default copy, with comments, is copied from the WAR to the user.home. - The config is *not* loaded. - If the file is there, a config object is instantiated and put in the servlet context. Does anyone else have a clever way of handling this issue? Thanks, - Paul Philion ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html |
- Servlets, WARs and configuration files Paul Philion
- Stephen Holmes