All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface org.apache.tomcat.core.ContextInterceptor

public interface ContextInterceptor
Notifications for all context events. Example: expand WAR, move files in the right directories ( Apache ?), read web.xml or check for a serialized form for faster init, etc.

Author:
costin@dnt.ro

Method Index

 o addContainer(Container)
A new location was added to the server.
 o addContext(ContextManager, Context)
Called when a context is added to a CM.
 o contextInit(Context)
Notify when a context is initialized.
 o contextShutdown(Context)
Called when a context is stoped, before removeContext.
 o engineInit(ContextManager)
Called when the ContextManger is started.
 o engineShutdown(ContextManager)
Called before the ContextManager is stoped.
 o postServletDestroy(Context, ServletWrapper)
 o postServletInit(Context, ServletWrapper)
 o preServletDestroy(Context, ServletWrapper)
Servlet Destroy notification
 o preServletInit(Context, ServletWrapper)
Servlet Init notification.
 o removeContainer(Container)
A rule was removed, update the internal strucures.
 o removeContext(ContextManager, Context)
Called when a context is removed from a CM.

Methods

 o engineInit
 public abstract void engineInit(ContextManager cm) throws TomcatException
Called when the ContextManger is started.

 o engineShutdown
 public abstract void engineShutdown(ContextManager cm) throws TomcatException
Called before the ContextManager is stoped. You need to stop any threads and remove any resources.

 o addContext
 public abstract void addContext(ContextManager cm,
                                 Context ctx) throws TomcatException
Called when a context is added to a CM. The context is probably not initialized yet, only path and docRoot are probably set. If you need informations that are available in web.xml use contextInit() ( a WebXmlReader needs to be the first interceptor in the contextInit chain ). We do that to support ( eventualy ) a "lazy" init, where you have many contexts, most of them not in active use, and you'll init them at first request. ( for example an ISP with many users )

 o contextInit
 public abstract void contextInit(Context ctx) throws TomcatException
Notify when a context is initialized. The first interceptor in the chain for contextInit must read web.xml and set the context. When this method is called you can expect the context to be filled in with all the informations from web.xml.

 o contextShutdown
 public abstract void contextShutdown(Context ctx) throws TomcatException
Called when a context is stoped, before removeContext. You must free all resources. XXX - do we need this or removeContext is enough ?? ( will be removed from 3.1 if nobody asks for it)

 o removeContext
 public abstract void removeContext(ContextManager cm,
                                    Context ctx) throws TomcatException
Called when a context is removed from a CM. A context is removed either as a result of admin ( remove or update), to support "clean" servlet reloading or at shutdown.

 o addContainer
 public abstract void addContainer(Container container) throws TomcatException
A new location was added to the server. A location is defined as a set of URL patterns with common properties. All servlet mappings and security constraints are in this category - with a common handler and a common set of authorized roles. An interceptor interested in mapping must implement this method and construct it's internal representation. The mapper is _required_ to find the Container associated with a request using the mapping rules defined in the Servlet API. The interceptor must also take care of "merging" parent with child containers. It is possible that this method will be called several times for the same url pattern ( for example to define a handler and then security constraints), the interceptor needs to merge the 2 containers. XXX define "merging" of containers

 o removeContainer
 public abstract void removeContainer(Container container) throws TomcatException
A rule was removed, update the internal strucures. You can also clean up and reload everything using Context.getContainers()

 o preServletInit
 public abstract void preServletInit(Context ctx,
                                     ServletWrapper sw) throws TomcatException
Servlet Init notification. XXX do we need "pre/post" for init/destroy ? transactions?

 o postServletInit
 public abstract void postServletInit(Context ctx,
                                      ServletWrapper sw) throws TomcatException
 o preServletDestroy
 public abstract void preServletDestroy(Context ctx,
                                        ServletWrapper sw) throws TomcatException
Servlet Destroy notification

 o postServletDestroy
 public abstract void postServletDestroy(Context ctx,
                                         ServletWrapper sw) throws TomcatException

All Packages  Class Hierarchy  This Package  Previous  Next  Index