To get the server info: ServletContext.getServerInfo()

Personally - I would state my webapp needs a directory[or database] to write/load its configuration. The directory or datasource would be setup using JNDI. Then its up to the system admin to use the Container specific functionality to setup the JNDI space. No war file code/config to change.

-Tim

Will Hartung wrote:
This is blasphemy, I know...but...

As far as I know, there is no portable way that a generic Webapp bundled in
a WAR, and dropped into a random container can persist information from one
run of the container to another.

On the one hand, there is no requirement that a WAR be exploded on deploy,
and you certainly can't write to a resource that's bundled in a Jar file.

On the other hand, you can get access to a Temp directory, and persist
information there, but there is no guarantee that the information will be
there when the container restarts.

What this means is that you can not take a portable WAR, plop it into an
arbitrary container, and then let the Webapp "self configure" with either
reasonable defaults, or even through a web page.

So, in order to get any portable persistence, you must:

a) Explode the WAR, change the web.xml to add/change a parameter, and
rebundle it and then deploy it.
b) Require that a database be present and publish the datasource name that
the web app is looking for, and assume that the user will configure their
container properly (and, of course, your web app must be compatible with
that database).
c) set a system property on the command line telling the Webapp its
persistence information
d) create a "less" portable Webapp and rely on container specific behaviors
on which you can make assumptions.

Actually, is there even an API that lets the Webapp identify its container?
There must be something somewhere, I just haven't looked.

So, what are you folks trying/doing to make "easily deployed" WARs that
needs to save setup options or even other real data?

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



Reply via email to