Package org.hotswap.agent.plugin.jetty
Class JettyPlugin
- java.lang.Object
-
- org.hotswap.agent.plugin.jetty.JettyPlugin
-
@Plugin(name="Jetty", description="Jetty plugin.", testedVersions={"6.1.26","7.6.14","8.1.14","9.1.2"}, expectedVersions={"4x","5x","6x","7x","8x","9x"}) public class JettyPlugin extends ObjectJetty servlet container support.Plugin
- Configure webapp classloader before first servlet is loaded
- webappDir configuration property
- extraClasspath configuration property (handled by WatchResourcesPlugin)
- watchResources configuration property (handled by WatchResourcesPlugin)
- Author:
- Jiri Bubnik
-
-
Constructor Summary
Constructors Constructor Description JettyPlugin()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit(Object contextHandler)Actual plugin initialization write plugin info and handle webappDir property.static voidpatchContextHandler6x(org.hotswap.agent.javassist.CtClass ctClass)Before app context is stopped, clean the classloader (and associated plugin instance).static voidpatchWebXmlConfiguration(org.hotswap.agent.javassist.CtClass ctClass)Plugin initialization step needs to be fine tuned.static voidpatchWebXmlConfiguration6x(org.hotswap.agent.javassist.CtClass ctClass)
-
-
-
Method Detail
-
patchWebXmlConfiguration
@OnClassLoadEvent(classNameRegexp="org.eclipse.jetty.webapp.WebXmlConfiguration") public static void patchWebXmlConfiguration(org.hotswap.agent.javassist.CtClass ctClass) throws org.hotswap.agent.javassist.NotFoundException, org.hotswap.agent.javassist.CannotCompileException, ClassNotFoundExceptionPlugin initialization step needs to be fine tuned. It can be intialized only AFTER the classloader already knows about hotswap-agent.properties file (i.e. after webapp basic path is added to the classloader), but BEFORE first servlet is initialized. WebXmlConfiguration seems to be good place which should work in most setups. The plugin is intialized before web.xml file is processed - basic paths should be known, but nothing is processed yet. Application classloader is processed during plugin initialization. It means that other plugins triggered on plugin init should fire as well - for jetty is important core watchResources plugin, which will handle extraClassPath and watchResources configuration properties (jetty fortunately depends only on basic URLClassLoader behaviour which is handled by that plugin).- Throws:
org.hotswap.agent.javassist.NotFoundExceptionorg.hotswap.agent.javassist.CannotCompileExceptionClassNotFoundException
-
patchWebXmlConfiguration6x
@OnClassLoadEvent(classNameRegexp="org.mortbay.jetty.webapp.WebXmlConfiguration") public static void patchWebXmlConfiguration6x(org.hotswap.agent.javassist.CtClass ctClass) throws org.hotswap.agent.javassist.NotFoundException, org.hotswap.agent.javassist.CannotCompileException, ClassNotFoundException- Throws:
org.hotswap.agent.javassist.NotFoundExceptionorg.hotswap.agent.javassist.CannotCompileExceptionClassNotFoundException
-
patchContextHandler6x
@OnClassLoadEvent(classNameRegexp="(org.mortbay.jetty.webapp.WebAppContext)|(org.eclipse.jetty.webapp.WebAppContext)") public static void patchContextHandler6x(org.hotswap.agent.javassist.CtClass ctClass) throws org.hotswap.agent.javassist.NotFoundException, org.hotswap.agent.javassist.CannotCompileException, ClassNotFoundExceptionBefore app context is stopped, clean the classloader (and associated plugin instance).- Throws:
org.hotswap.agent.javassist.NotFoundExceptionorg.hotswap.agent.javassist.CannotCompileExceptionClassNotFoundException
-
init
public void init(Object contextHandler)
Actual plugin initialization write plugin info and handle webappDir property. If the webappDir property is set, call:contextHandler.setBaseResource(new ResourceCollection( new FileResource(webappDir), contextHandler.getBaseResource() ));- Parameters:
contextHandler- instance of ContextHandler - main jetty class for webapp.
-
-