org.apache.tomcat.modules.mappers
Class ReloadInterceptor

java.lang.Object
  |
  +--org.apache.tomcat.core.BaseInterceptor
        |
        +--org.apache.tomcat.modules.mappers.ReloadInterceptor

public class ReloadInterceptor
extends BaseInterceptor

This interceptor deals with context reloading. This should be "AT_END" - just after the context is mapped, it will determine if the context needs reload. This interceptor supports multiple forms of reloading. Configuration. Must be set after LoaderInterceptor


Fields inherited from class org.apache.tomcat.core.BaseInterceptor
cm, ct, ctx, debug, DECLINED, loghelper, OK
 
Constructor Summary
ReloadInterceptor()
           
 
Method Summary
 void addContext(ContextManager cm, Context context)
          Called when a context is added to a CM.
 void contextInit(Context context)
          Example of adding web.xml to the dependencies.
 int contextMap(Request request)
          Will detect the context path for a request.
 void engineInit(ContextManager cm)
          Initialize the module.
protected  void loaderHook(DependManager dm, Context context)
           
 void reload(Request req, Context context)
          Reload notification - called whenever a reload is done.
 void setFullReload(boolean full)
          A full reload will stop and start the context, without saving any state.
 
Methods inherited from class org.apache.tomcat.core.BaseInterceptor
addContainer, addHandler, addInterceptor, addSecurityConstraint, afterBody, authenticate, authorize, beforeBody, beforeCommit, contextShutdown, contextState, engineShutdown, engineStart, engineState, engineStop, findSession, getContext, getContextManager, getDebug, getInfo, getLog, getNote, getNote, handleError, log, log, log, log, postReadRequest, postRequest, postService, postServletDestroy, postServletInit, preService, preServletDestroy, preServletInit, registerHooks, removeContainer, removeContext, removeHandler, removeInterceptor, requestMap, sessionState, setContext, setContextManager, setDebug, setInfo, setNote, setNote
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReloadInterceptor

public ReloadInterceptor()
Method Detail

engineInit

public void engineInit(ContextManager cm)
                throws TomcatException
Description copied from class: BaseInterceptor
Initialize the module.
Overrides:
engineInit in class BaseInterceptor
Following copied from class: org.apache.tomcat.core.BaseInterceptor
Throws:
TomcatException - The module will not be added if any exception is thrown by engineInit.

setFullReload

public void setFullReload(boolean full)
A full reload will stop and start the context, without saving any state. It's the cleanest form of reload, equivalent with (partial) server restart.

addContext

public void addContext(ContextManager cm,
                       Context context)
                throws TomcatException
Description copied from class: BaseInterceptor
Called when a context is added to a CM. The context is probably not initialized yet, only path, docRoot, host, and properties set before adding the context ( in server.xml for example ) are available. At this stage mappers can start creating structures for the context ( the actual loading of the context may be delayed in future versions of tomcat until the first access ). DefaultCMSetter will also adjust the logger and paths based on context manager properties. Any activity that depends on web.xml must be done at init time.
Overrides:
addContext in class BaseInterceptor

contextInit

public void contextInit(Context context)
                 throws TomcatException
Example of adding web.xml to the dependencies. JspInterceptor can add all taglib descriptors.
Overrides:
contextInit in class BaseInterceptor
Following copied from class: org.apache.tomcat.core.BaseInterceptor
Throws:
If - the interceptor throws exception the context will not be initialized ( state==NEW or ADDED or DISABLED ).

reload

public void reload(Request req,
                   Context context)
            throws TomcatException
Description copied from class: BaseInterceptor
Reload notification - called whenever a reload is done. This can be used to serialize sessions, log the event, remove any resource that was class-loader dependent. Note. The current implementation uses a note "oldLoader" that will keep a reference to the previous class loader during this hook. It will be set by the module that creates the loaders, and should be destroyed when the hook is done. This can also be implemented using a get/setOldClassLoader in Context, but so far this is used in only 2 modules, adding new API is not needed.
Overrides:
reload in class BaseInterceptor

loaderHook

protected void loaderHook(DependManager dm,
                          Context context)

contextMap

public int contextMap(Request request)
Description copied from class: BaseInterceptor
Will detect the context path for a request. It need to set: context, contextPath, lookupPath A possible use for this would be a "user-home" interceptor that will implement ~costin servlets ( add and map them at run time).
Overrides:
contextMap in class BaseInterceptor


Copyright © 2001 Apache Software Foundation. All Rights Reserved.