org.apache.tomcat.modules.config
Class LoaderInterceptor11

java.lang.Object
  extended byorg.apache.tomcat.core.BaseInterceptor
      extended byorg.apache.tomcat.modules.config.LoaderInterceptor11

public class LoaderInterceptor11
extends BaseInterceptor

Set class loader based on WEB-INF/classes, lib. Compatible with JDK1.1, but takes advantage of URLClassLoader if java2 is detected. Note. LoaderInterceptor must be the first in the reload and contextInit chains.

Author:
costin@dnt.ro

Field Summary
 
Fields inherited from class org.apache.tomcat.core.BaseInterceptor
cm, ct, ctx, debug, DECLINED, loghelper, OK
 
Constructor Summary
LoaderInterceptor11()
           
 
Method Summary
 void addContext(ContextManager cm, Context context)
          Add all WEB-INF/classes and WEB-INF/lib to the context path
protected  java.lang.ClassLoader constructLoader(Context context)
          Override this method to provide an alternate loader (or create a new interceptor )
 void contextInit(Context ctx)
          setup the ClassLoader for this context.
 void copyContext(Request req, Context oldC, Context newC)
          Reload notification - called whenever a full reload is done.
 void engineInit(ContextManager cm)
          Initialize the module.
 java.lang.Object getInfo(Context ctx, Request req, int info, java.lang.String k)
          Hook for lazy evaluation of request info.
 void prepareClassLoader(Context context)
          Initialize the class loader.
 void reload(Request req, Context context)
          Construct another class loader, when the context is reloaded.
 void setAdditionalJars(java.lang.String jars)
          List of additional jars to add to each web application.
 void setJarSeparator(java.lang.String sep)
          Character to use to separate jars in the jaxpJars list.
 void setJaxp(boolean b)
          Check if the webapp contains jaxp , and add one if not.
 void setJaxpDir(java.lang.String dir)
          Directory where jaxp jars are installed.
 void setJaxpJars(java.lang.String jars)
          Name of the jars that compose jaxp.
 void setLoader(java.lang.String name)
           
 void setUse11Loader(boolean b)
          Use the 1.1 loader even if running under Java2.
 void setUseApplicationLoader(boolean b)
          Use ContextManager.getParentLoader() - typlically the class loader that is set by the application embedding tomcat.
 void setUseNoParent(boolean b)
          Use no parent loader.
 
Methods inherited from class org.apache.tomcat.core.BaseInterceptor
addContainer, addHandler, addInterceptor, addSecurityConstraint, afterBody, authenticate, authorize, beforeBody, beforeCommit, contextMap, contextShutdown, contextState, engineShutdown, engineStart, engineState, engineStop, findSession, getContext, getContextManager, getDebug, getLog, getNote, getNote, handleError, log, log, log, log, postInitCheck, postReadRequest, postRequest, postService, postServletDestroy, postServletInit, preInitCheck, 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

LoaderInterceptor11

public LoaderInterceptor11()
Method Detail

setUseApplicationLoader

public void setUseApplicationLoader(boolean b)
Use ContextManager.getParentLoader() - typlically the class loader that is set by the application embedding tomcat.


setUseNoParent

public void setUseNoParent(boolean b)
Use no parent loader. The contexts will be completely isolated.


setUse11Loader

public void setUse11Loader(boolean b)
Use the 1.1 loader even if running under Java2. This allows for a work-around to the currently broken URLClassLoader which can't reload classes from changed jar files.


setJaxpDir

public void setJaxpDir(java.lang.String dir)
Directory where jaxp jars are installed. Defaults to tomcat_install/lib/container, where the parser used by tomcat internally is located.


setJaxpJars

public void setJaxpJars(java.lang.String jars)
Name of the jars that compose jaxp. Defaults to jaxp.jar:crimson.jar:xalan.jar:xerces.jar, it'll match either crimson or xerces.


setAdditionalJars

public void setAdditionalJars(java.lang.String jars)
List of additional jars to add to each web application.


setJarSeparator

public void setJarSeparator(java.lang.String sep)
Character to use to separate jars in the jaxpJars list. It also applies to the additionalJars context property list.


setJaxp

public void setJaxp(boolean b)
Check if the webapp contains jaxp , and add one if not. This allow apps to include their own parser if they want, while using the normal delegation model. A future module will extend this and implement a more advanced and generic mechanism


setLoader

public void setLoader(java.lang.String name)

engineInit

public void engineInit(ContextManager cm)
                throws TomcatException
Description copied from class: BaseInterceptor
Initialize the module.

Overrides:
engineInit in class BaseInterceptor
Throws:
TomcatException - The module will not be added if any exception is thrown by engineInit.

addContext

public void addContext(ContextManager cm,
                       Context context)
                throws TomcatException
Add all WEB-INF/classes and WEB-INF/lib to the context path

Overrides:
addContext in class BaseInterceptor
Throws:
TomcatException

contextInit

public void contextInit(Context ctx)
                 throws TomcatException
setup the ClassLoader for this context. If this is a re-loaded context, do nothing.

Overrides:
contextInit in class BaseInterceptor
Throws:
TomcatException

copyContext

public void copyContext(Request req,
                        Context oldC,
                        Context newC)
                 throws TomcatException
Description copied from class: BaseInterceptor
Reload notification - called whenever a full reload is done. This can be used to serialize sessions, log the event, clone any resource that was class-loader dependent.

Overrides:
copyContext in class BaseInterceptor
Throws:
TomcatException

reload

public void reload(Request req,
                   Context context)
            throws TomcatException
Construct another class loader, when the context is reloaded.

Overrides:
reload in class BaseInterceptor
Throws:
TomcatException

prepareClassLoader

public void prepareClassLoader(Context context)
                        throws TomcatException
Initialize the class loader.

Throws:
TomcatException

constructLoader

protected java.lang.ClassLoader constructLoader(Context context)
                                         throws TomcatException
Override this method to provide an alternate loader (or create a new interceptor )

Throws:
TomcatException

getInfo

public final java.lang.Object getInfo(Context ctx,
                                      Request req,
                                      int info,
                                      java.lang.String k)
Description copied from class: BaseInterceptor
Hook for lazy evaluation of request info. This provides and uniform mechanism to allow modules to evaluate certain expensive request attributes/parameters when they are needed ( if ever ), and allows specialized modules and better integration with the web server/server modules. This replaces a number of hard-coded constructs and should clean up the core for un-needed dependencies, as well as provide flexibility in key areas as encoding, etc.

Overrides:
getInfo in class BaseInterceptor


Copyright ? 2001 Apache Software Foundation. All Rights Reserved.