org.apache.tomcat.util.hooks
Class Hooks
java.lang.Object
org.apache.tomcat.util.hooks.Hooks
- public class Hooks
- extends java.lang.Object
Hooks support. Hooks implement a chain-of-command pattern, and
are commonly used in most web servers as a mechanism of extensibility.
This class doesn't deal with hook invocation - the program is expected
to use interfaces or base classes with the hooks beeing methods that
are invoked. Reflection-based invocation is very expensive and shouldn't
be used.
The Hooks class will provide support for registering and maintaining
a list of modules implementing each hook.
The module can be added automatically to the right lists by using
introspection ( if the module implements a certain method, it'll
be added to the chain for the hook with the same name ). It is also
possible for a module to explicitely register hooks.
This class is modeled after Apache2.0 hooks - most web servers are using
this pattern, but so far A2.0 has the most flexible and powerfull
implementation
Nested Class Summary |
static interface |
Hooks.HookFinder
Interface that decouples the Hooks from the introspection code. |
Constructor Summary |
Hooks()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INITIAL_HOOKS
public static final int INITIAL_HOOKS
- See Also:
- Constant Field Values
Hooks
public Hooks()
getHooksVector
public java.util.Vector getHooksVector(int type)
- Allow direct access to hooks. You must call resetCache()
if you change the hooks
getHooksVector
public java.util.Vector getHooksVector()
resetCache
public void resetCache()
registerHook
public int registerHook(java.lang.String name)
registerHook
public void registerHook(java.lang.String name,
int id)
getHookName
public java.lang.String getHookName(int id)
getHookId
public int getHookId(java.lang.String hookName)
addModule
public void addModule(java.lang.Object bi)
- Add the module to all the hook chains it's implements
The hook name should match a method defined in the module
( not inherited - explicitely defined there )
addModule
public void addModule(java.lang.String type,
java.lang.Object bi)
removeModule
public void removeModule(java.lang.Object bi)
getModules
public java.lang.Object[] getModules(int type)
getModules
public java.lang.Object[] getModules()
- Get all interceptors
setHookFinder
public static void setHookFinder(Hooks.HookFinder hf)
Copyright © 2001 Apache Software Foundation. All Rights Reserved.