Am 2013-03-16 10:46, schrieb Konstantin Kolinko:
2013/3/16 Michael-O <1983-01...@gmx.net>:
Hi,

I'd like to make a string available as an env entry via JNDI. The string is
static but must be created dynamically at startup time of the webapp.

I have evaluated and implemented a listener which I have added to my
context.xml. It listens for startup and shutdown events. It works pretty
well. Rethinking this makes me ask whether a listener is the right thing to
do.

Would an object factory a better approach for this?
Did I abuse the listener concept?

Code is available for inspection.


1. Tomcat version =?

I am on Tomcat 6.0.35.

2. Looking at docs,
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Environment%20Entries
I do not see factory as an allowed attribute for environment entries.

That was not my intent. I was referring to <Resource> instead of <Environment>.

3. Do you have control over code that uses the value?

No(t really), it's Logback. I retrieve the value from JNDI in the logback.xml.

4. Listeners are OK. I wonder though whether JNDI is modifiable or
read-only at that point in time. If it works for you, then it is has
to be modifiable.

It is modifiable. See my implementation please:
http://tinyurl.com/a79jdgt

And the usecase for:
http://tinyurl.com/afu9ppl

I have this in production for almost a year now but decided finally to make it publically available under ASLv2. That's the reason for my doubts.

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to