On Tue, 2002-09-10 at 19:53, Milt Epstein wrote:
> On 10 Sep 2002, Craig Longman wrote:
> >
> > well, i'm going to have to be very careful.  i have no idea what context
> > i'm receiving, but it doesn't appear to be the ActionServlet, there are
> > no init parameters in it at all.
> 
> I'm confused (or maybe you are :-).  What do you mean, you have no
> idea what context you're receiving?  There is only one context it can
> receive, the context it's part of.  Remember, you're defining the
> listener in the web.xml file, and that's part of a context.

i know i am a bit confused and frustrated, days spent figuring out
config files, now more time spent figuring out how to use my own simple
config file!

> As to init parameters, I'm not sure what you're trying to do with
> them, but note that you can set up context parameters in the web.xml,
> and that you can get the context (via the getServletContext() method)
> from the ServletContextEvent that's passed to the context listener
> methods (so you can have access to the context parameters).  You can
> also use a properties file, as others have suggested.

yes, but calling getServletContext().getInitParameterNames() produces an
empty enumeration.  when i said, 'i don't know what context i'm
receiving', i meant that there were no init parameters provided, but
there are definitely some in the one and only <servlet> section i have. 
i guess i was assuming that the context listener was related to a
servlet.  in retrospect now, i can see its not.

so, i wonder if there is some way of getting init parameters into this
context that gets passed, the default context or something i guess.

anyway, i've had to just hard code the filename into the listener, using
the ServletContext.getRealPath( "/" ) + "/WEB-INF/" directory.  crazy.

> > so, i'm a little bit further ahead, at least i have the preferred log to
> > write to, but still no convenient method of passing it configuration
> > parameters.  i'm off to investigate if there is any mechanism in the
> > <listener> stuff that i can use.
> 
> See above.  It looks like Tomcat has some additional mechanisms for
> handling configuration parameters (e.g. Listener tags in the
> server.xml file, but that may make your set up not portable).

it does.  i have no idea why the architects of the whatever spec drives
the web.xml were so insistent on being as verbose as they were.  doing
it the tomcat introspection way seems so sensible, and perfectly
flexible at the same time.

-- 

    CraigL->Thx();
    Be Developer ID: 5852

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to