Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2015-11-18 20:10:36 -0500
committerGreg Wilkins2015-11-18 20:14:05 -0500
commita311c8bde171551a57ff28c04851a3b53acfc1e0 (patch)
tree39dafd6f524d0b2b0e834888a66ebc1603614dc4 /jetty-plus
parent65d33f8b49bd51140d9fe9b024c5dd42ad7571d8 (diff)
downloadorg.eclipse.jetty.project-a311c8bde171551a57ff28c04851a3b53acfc1e0.tar.gz
org.eclipse.jetty.project-a311c8bde171551a57ff28c04851a3b53acfc1e0.tar.xz
org.eclipse.jetty.project-a311c8bde171551a57ff28c04851a3b53acfc1e0.zip
480904 - jetty-util Loader simplification
The Loader has been simplified to now just be a switch between loading from the context loader, the same loader as another class or the system loader. Multiple loaders will never be tried. A new runWithServerClassAccess(PriviledgedAction) method has been added to WebAppClassLoader, that is now used during configuration for actions that need access to both the WEB-INF/lib classes and the server classes (eg jetty-web.xml and env.xml). The JMX MBean mechanism has also been modified to look for an MBean class in the same loader that object came from before attempting the context loader (only if different).
Diffstat (limited to 'jetty-plus')
-rw-r--r--jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/ContainerInitializer.java2
-rw-r--r--jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/LifeCycleCallback.java2
-rw-r--r--jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/EnvConfiguration.java3
3 files changed, 4 insertions, 3 deletions
diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/ContainerInitializer.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/ContainerInitializer.java
index 129b300e9a..1cd7570b5b 100644
--- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/ContainerInitializer.java
+++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/ContainerInitializer.java
@@ -127,7 +127,7 @@ public class ContainerInitializer
try
{
for (String s : _applicableTypeNames)
- classes.add(Loader.loadClass(context.getClass(), s));
+ classes.add(Loader.loadClass(s));
context.getServletContext().setExtendedListenerTypes(true);
if (LOG.isDebugEnabled())
diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/LifeCycleCallback.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/LifeCycleCallback.java
index f226179e67..16f555fd8a 100644
--- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/LifeCycleCallback.java
+++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/annotation/LifeCycleCallback.java
@@ -106,7 +106,7 @@ public abstract class LifeCycleCallback
if (_target == null)
{
if (_targetClass == null)
- _targetClass = Loader.loadClass(null, _className);
+ _targetClass = Loader.loadClass(_className);
_target = _targetClass.getDeclaredMethod(_methodName, TypeUtil.NO_ARGS);
}
diff --git a/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/EnvConfiguration.java b/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/EnvConfiguration.java
index 2f26edfc7a..1a401d6689 100644
--- a/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/EnvConfiguration.java
+++ b/jetty-plus/src/main/java/org/eclipse/jetty/plus/webapp/EnvConfiguration.java
@@ -41,6 +41,7 @@ import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.webapp.AbstractConfiguration;
import org.eclipse.jetty.webapp.Configuration;
+import org.eclipse.jetty.webapp.WebAppClassLoader;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.xml.XmlConfiguration;
@@ -113,7 +114,7 @@ public class EnvConfiguration extends AbstractConfiguration
{
localContextRoot.getRoot().addListener(listener);
XmlConfiguration configuration = new XmlConfiguration(jettyEnvXmlUrl);
- configuration.configure(context);
+ WebAppClassLoader.runWithServerClassAccess(()->{configuration.configure(context);return null;});
}
finally
{

Back to the top