You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cm...@yahoo.com on 2000/09/16 22:03:18 UTC

TC3: proposal - Interceptors

Hi,

I am still reviewing the core and attempting to make it "as simple as
possible but not simpler". 

I did a small refactoring of interceptors ( including individual chains
for each hook and the ability to add only the interceptors that are
interested in a certain callback). The implementation doesn't require any
change in user code, it's another nice reflection hack ( detect if a
certain method is overriden).

It seems that most interceptors are extending BaseInterceptor - and please
let me know if you are not doing so.

My proposal is:

1. Deprecate RequestInterceptor and ContextInterceptor ( as interfaces),
keep only BaseInterceptor. All 3 implement the same concepts -  chain of
command and strategy pattern, and having a single interface will simplify
future evolution ( see next ). 
There is little or no impact on existing code. 
I also think it will be easier to understand and document, and more
consistent with the rest of tomcat.

2. In time, add event/listener model interfaces for  all context level
events. That will have minimal impact on performance ( since the callbacks
happen at startup or on admin changes ). The 2 models can work in paralel
until the interceptors are rewritten. 
This will provide a simpler and more familiar model.
So far I'm thinking about:
  package org.apache.tomcat.core.events
   ContextEvent, ContextListener, ServerEvent, ServerListener,
EventManager.


( the reason for (1) is that the code to manage hooks using
BaseInterceptor as base class and detect if the method is overriden is
much simpler, and it's more consistent with the rest of tomcat3. )

Costin