chris brown wrote:
>
> Hello,
>
> I'm developing a web app which I plan to deploy on several systems. I'm
> trying to avoid hard-coding anything into the app, so for example database
> connections, log file paths, etc. are specified as init-params on the
> appropriate servlets.
>
> When I deploy this as a "war" file (web archive), I'd like it if the
> administrator of the system where it's being deployed can modify the init
> params WITHOUT unarchiving / decompressing the archive (especially I need to
> sign or otherwise encrypt the archive). If not, how else can I design an
> app so that it's portable and easy to deploy?
The idea behind the init parameters in web.xml is that the container
should provide deployment tools where the values can be set. Some
containers do, others don't. For those that don't, I don't see any way
to avoid unpacking the WAR file, but instead of asking the administrator
to edit the web.xml file, you may have your own configuration file in
the WEB-INF directory (e.g. a properties file or an XML file). You can
easily read a file from WEB-INF with context.getResourceAsStream().
There's one other alternative, but only for containers that provide JNDI
support (all complete J2EE containers, but not all simple web containers).
For this type of container you can use the <resource-ref> and <env-entry>
elements in the web.xml file to declare names for all configuration items
you need. The deployer then configures these items in the JNDI server, and
the web application get access to them through JNDI calls.
Hans
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
Author of JavaServer Pages (O'Reilly), http://TheJSPBook.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets