On Fri, 23 Mar 2001, T. Park wrote:

> 
> Hello,
> 
> I'm a newbie to the Catalina code line and need some guidance (lots actually)...
> 
> I have a custom interceptor that works really well with Tomcat 3.x that does
> some special setup work
> in the preServletInit/postServletInit, preService/postService and
> preServletDestroy/postServletDestroy methods of
> the special RequestInterceptor.
> 
> My problem is determining functional equivalents to these in Catalina.
> 

The model for customized request processing in Catalina is quite a bit
different than Tomcat 3.x.  Fundamentally, you use a Valve for most
processing.  Valves implement the "chain of responsibility" pattern from
the GoF book -- and once you understand them, you will also understand how
Filters work in the servlet 2.3 spec :-).  However, Valves don't directly
do what you're asking for here.

The Context element supports the registration of InstanceListener objects,
which receive InstanceEvent notifications of the six events you mentioned
above, plus beforeFilter and afterFilter (2.3 specific).  This follows the
usual JavaBeans patterns for event notification.

>From server.xml, you can configure instance listeners by nesting a new
element inside the <Context>

        <Context path="/..." ...>
                <InstanceListener className="com.mycompany.MyListener/>
        </Context>

> Can anyone give me any pointers - I sort of lost my way in the source code and
> documentation
> (primarily due to existing references to 'interceptors' in both comments and
> docs.)
> 
> Is there still a way to do some pre/post processing for each corresponding
> servlet call (init,destroy and service).
> 
> I looked at VavleBase and couldn't see any direct comparison.
> 
> -Thom
> 
> 
> 
> 

Craig McClanahan

Reply via email to