You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by tp...@borland.com on 2001/07/09 18:40:00 UTC

InstanceListener syntax?

Hi folks,

can someone give me the definitive syntax for the InstanceListener?
Also, is it possible to setup an Engine (or Host) level InstanceListener
that would get applied to all context's within said Engine or Host?

Having to add a InstanceListener to every context just to get the old
tomcat 3.2 pre/post Lifecycle event (Init,service,destroy) support is a 
bit onerous.

-Thom



RE: InstanceListener syntax?

Posted by Thom Park <tp...@borland.com>.
I've had a better look at DefaultContext, it appears to do what I want -
i.e.
give me the ability to define InstanceListener once that will be applied
for all contexts within a given host.

Now I need to find out how to define a DefaultContext ;-)

-Thom


-----Original Message-----
From: glenn@zathras.earthdome.org [mailto:glenn@zathras.earthdome.org]On
Behalf Of Glenn Nielsen
Sent: Tuesday, July 10, 2001 6:16 AM
To: tomcat-dev@jakarta.apache.org
Subject: Re: InstanceListener syntax?


Remy Maucherat wrote:
>
> > Hi folks,
> >
> > can someone give me the definitive syntax for the InstanceListener?
> > Also, is it possible to setup an Engine (or Host) level InstanceListener
> > that would get applied to all context's within said Engine or Host?
> >
> > Having to add a InstanceListener to every context just to get the old
> > tomcat 3.2 pre/post Lifecycle event (Init,service,destroy) support is a
> > bit onerous.
>
> Glenn, would the default context help here ?
>
> Remy

Its in the code for DefaultContext, but I don't know if it has been tested.

Glenn

----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------


RE: InstanceListener syntax?

Posted by Thom Park <tp...@borland.com>.
Hi Guys,

I'm a wee bit confused - I was looking for the XML Syntax for the
InstanceListener, not how it's
being used within the default context.

I've tried the following in server.xml (within a Context definition):

<InstanceListener>
 	my.instance.listener
</InstanceListener>

And this works fine, however it doesn't match the other more familiar
constructs
within server.xml, something similar to:

<InstanceListener
	className=my.instance.listener
	debug="99">
</InstanceListener>

I was just curious as to what, if any, xml exposed options were available
for InstanceListener.

And again, I'm still wondering if it's possible to have an Engine or Host
level instance listener be applied
to all Contexts (where the context doesn't have an Instance entry of it's
own).

How is DefaultContext used? Is it used in the case where there is not a
Context entry for a war file being served
by tomcat?

Either way, it looks to me that, if I want to handle before/after events for
any given servlet, I need to specifically add
an InstanceListener to each and every Context.

Does anyone know of an alternative way of catching the before and after
stages of servlet init, service and destroy?

In tomcat 3.2 I just used a specialized Interceptor (which nicely applied to
all contexts) this new way is a bit awkward...

Hmm... maybe I can add a InstanceListener list to the parent container(s)
and, in the code that handles the current
InstanceListener processing, in the absence of there being a ContextLevel
InstanceListener, I could go up the hierarchy looking for
Instance listeners to invoke.

Any thoughts if that makes sense - or am I likely to get in trouble with
class loading (Context level vs. host & Engine level)...


-Thom

-----Original Message-----
From: glenn@zathras.earthdome.org [mailto:glenn@zathras.earthdome.org]On
Behalf Of Glenn Nielsen
Sent: Tuesday, July 10, 2001 6:16 AM
To: tomcat-dev@jakarta.apache.org
Subject: Re: InstanceListener syntax?


Remy Maucherat wrote:
>
> > Hi folks,
> >
> > can someone give me the definitive syntax for the InstanceListener?
> > Also, is it possible to setup an Engine (or Host) level InstanceListener
> > that would get applied to all context's within said Engine or Host?
> >
> > Having to add a InstanceListener to every context just to get the old
> > tomcat 3.2 pre/post Lifecycle event (Init,service,destroy) support is a
> > bit onerous.
>
> Glenn, would the default context help here ?
>
> Remy

Its in the code for DefaultContext, but I don't know if it has been tested.

Glenn

----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------


Re: InstanceListener syntax?

Posted by Glenn Nielsen <gl...@voyager.apg.more.net>.
Remy Maucherat wrote:
> 
> > Hi folks,
> >
> > can someone give me the definitive syntax for the InstanceListener?
> > Also, is it possible to setup an Engine (or Host) level InstanceListener
> > that would get applied to all context's within said Engine or Host?
> >
> > Having to add a InstanceListener to every context just to get the old
> > tomcat 3.2 pre/post Lifecycle event (Init,service,destroy) support is a
> > bit onerous.
> 
> Glenn, would the default context help here ?
> 
> Remy

Its in the code for DefaultContext, but I don't know if it has been tested.

Glenn

----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

Re: InstanceListener syntax?

Posted by Remy Maucherat <re...@apache.org>.
> Hi folks,
> 
> can someone give me the definitive syntax for the InstanceListener?
> Also, is it possible to setup an Engine (or Host) level InstanceListener
> that would get applied to all context's within said Engine or Host?
> 
> Having to add a InstanceListener to every context just to get the old
> tomcat 3.2 pre/post Lifecycle event (Init,service,destroy) support is a 
> bit onerous.

Glenn, would the default context help here ?

Remy