In custom context.xml, you can define the ressource, that is mainly Datasources that are linked with jndi. Just define a datasource and store your config in the database. Or if you want more complicated things, store other tyes of objects in your jndi, by defining them in your context.xml.

Note that, even if you provide a custom context.xml, this one will be overriden by the one in META-INF/context.xml during deployement of webapp! In general, i would say, if you want to store things outside the war, just make it accessible either from database or from JNDI.

As to your suggestion, i think it will bring more complexity and is more error prone than embedding config in war. Some commercial application i have seen (JIRA for example), just provide a folder you unpack on your development station, you configure it, then type "ant war" and you get a ready to deploy webapp. No need to tocuh anything server side.


lightbulb432 wrote:
Similar to how you can specify an mycontext.xml in conf/Catalina/localhost to
specify the context without having to modify prepackaged WAR files, can you
so something like place files in context-specific folders (i.e.
conf/Catalina/localhost/mycontext/resource1.properties) that would be
accessible from the classpath of the web app?

If it doesn't exist, would it be a good feature request? It would accomplish
multiple things:
- Wouldn't expose the classpath resources to more web applications than
intended (which would be the case if you put it in CATALINA_HOME/lib).
- Would allow deployers to not have to modify the web.xml and place the
classpath resource in WEB-INF/classes or WEB-INF/lib.
- Would prevent developers from having to code using absolute filenames.

First of all, is a feature similar to what I'm suggesting available in
Tomcat? If not, what do you think of such a feature request?

Thanks.



lightbulb432 wrote:
When deploying a WAR file whose code uses information stored in classpath
configuration resources, where should you store these configuration files
if outside of the WAR file?

If you want to keep these configuration files outside of the WAR file to
make for easier deployment in multiple environments, isn't the only other
classpath available to Tomcat within its own lib folder? And in that case,
the configuration file would be available in all contexts. So where should
such a file be stored (i.e. available to the webapp as a resource but not
available to all contexts)?

Thanks.




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to