From a0c1d850949e282b1ca2043be722a7f3c9d8680b Mon Sep 17 00:00:00 2001 From: Jesse McConnell Date: Mon, 19 Nov 2012 10:33:54 -0600 Subject: [PATCH] Revert "jetty-9 cleaned up serverClasses to minimum" This reverts commit 67b5caadbb59851fe2d5292bf5a38b846de9b29c. --- examples/async-rest/async-rest-jar/pom.xml | 1 - examples/async-rest/async-rest-webapp/pom.xml | 6 ---- .../src/main/webapp/WEB-INF/jetty-web.xml | 3 -- .../jetty/example/asyncrest/DemoServer.java | 2 ++ .../src/main/config/etc/jetty-deploy.xml | 2 +- jetty-util-ajax/pom.xml | 1 - .../webapp/StandardDescriptorProcessor.java | 20 +++++------- .../eclipse/jetty/webapp/WebAppContext.java | 14 +++++++-- jetty-websocket/websocket-servlet/pom.xml | 1 - tests/test-webapps/test-jetty-webapp/pom.xml | 31 +++++++++++++++++-- .../src/main/webapp/WEB-INF/jetty-web.xml | 3 -- .../java/org/eclipse/jetty/TestServer.java | 8 ++--- 12 files changed, 53 insertions(+), 39 deletions(-) diff --git a/examples/async-rest/async-rest-jar/pom.xml b/examples/async-rest/async-rest-jar/pom.xml index db25076f28a..919bcd955d7 100644 --- a/examples/async-rest/async-rest-jar/pom.xml +++ b/examples/async-rest/async-rest-jar/pom.xml @@ -14,7 +14,6 @@ org.eclipse.jetty jetty-client ${project.version} - provided org.eclipse.jetty diff --git a/examples/async-rest/async-rest-webapp/pom.xml b/examples/async-rest/async-rest-webapp/pom.xml index b41d3084276..4544b19ade0 100644 --- a/examples/async-rest/async-rest-webapp/pom.xml +++ b/examples/async-rest/async-rest-webapp/pom.xml @@ -18,12 +18,6 @@ example-async-rest-jar ${project.version} - - org.eclipse.jetty - jetty-client - ${project.version} - test - org.eclipse.jetty jetty-webapp diff --git a/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml index d30fb228479..572942fd5ca 100644 --- a/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/examples/async-rest/async-rest-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -12,7 +12,4 @@ org.eclipse.jetty.servlet.WebApplicationContext object async-rest webapp is deployed. DO NOT USE IN PRODUCTION! - - -org.eclipse.jetty.client. - diff --git a/examples/async-rest/async-rest-webapp/src/test/java/org/eclipse/jetty/example/asyncrest/DemoServer.java b/examples/async-rest/async-rest-webapp/src/test/java/org/eclipse/jetty/example/asyncrest/DemoServer.java index da909fb8a33..91471d50da1 100644 --- a/examples/async-rest/async-rest-webapp/src/test/java/org/eclipse/jetty/example/asyncrest/DemoServer.java +++ b/examples/async-rest/async-rest-webapp/src/test/java/org/eclipse/jetty/example/asyncrest/DemoServer.java @@ -33,6 +33,8 @@ public class DemoServer WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/"); webapp.setWar(jetty_home+"/target/async-rest/"); + webapp.setParentLoaderPriority(true); + webapp.setServerClasses(new String[]{}); server.setHandler(webapp); server.start(); diff --git a/jetty-deploy/src/main/config/etc/jetty-deploy.xml b/jetty-deploy/src/main/config/etc/jetty-deploy.xml index 0572fc54bca..9b42604d6d3 100644 --- a/jetty-deploy/src/main/config/etc/jetty-deploy.xml +++ b/jetty-deploy/src/main/config/etc/jetty-deploy.xml @@ -36,7 +36,7 @@ --> - + /webapps diff --git a/jetty-util-ajax/pom.xml b/jetty-util-ajax/pom.xml index b649a823f82..c08c077e2c4 100644 --- a/jetty-util-ajax/pom.xml +++ b/jetty-util-ajax/pom.xml @@ -75,7 +75,6 @@ org.eclipse.jetty jetty-util ${project.version} - provided org.eclipse.jetty.orbit diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java index 3bfb7f27e4b..ef8681f5751 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/StandardDescriptorProcessor.java @@ -1854,19 +1854,12 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor ((WebDescriptor)descriptor).addClassName(className); - Class listenerClass = context.loadClass(className); - if (listenerClass==null) + Class listenerClass = (Class)context.loadClass(className); + listener = newListenerInstance(context,listenerClass); + if (!(listener instanceof EventListener)) { - throw new RuntimeException("Could not Load EventListener: " + className); - } - if (!(EventListener.class.isAssignableFrom(listenerClass))) - { - throw new RuntimeException("Not an EventListener: " + className); - } - listener = newListenerInstance(context,(Class)listenerClass); - if (listener==null) - { - throw new RuntimeException("Could not Load EventListener: " + className); + LOG.warn("Not an EventListener: " + listener); + return; } context.addEventListener(listener); context.getMetaData().setOrigin(className+".listener", descriptor); @@ -1875,7 +1868,8 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor } catch (Exception e) { - throw new RuntimeException("Could not instantiate listener " + className, e); + LOG.warn("Could not instantiate listener " + className, e); + return; } } diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java index 6c64a27a564..6abfaba3349 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java @@ -104,14 +104,18 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL // System classes are classes that cannot be replaced by // the web application, and they are *always* loaded via - // system classloader if possible + // system classloader. public final static String[] __dftSystemClasses = { "java.", // Java SE classes (per servlet spec v2.5 / SRV.9.7.2) "javax.", // Java SE classes (per servlet spec v2.5 / SRV.9.7.2) "org.xml.", // needed by javax.xml "org.w3c.", // needed by javax.xml - "org.eclipse.jetty.", // webapp cannot change jetty classes + "org.eclipse.jetty.continuation.", // webapp cannot change continuation classes + "org.eclipse.jetty.jndi.", // webapp cannot change naming classes + "org.eclipse.jetty.jaas.", // webapp cannot change jaas classes + "org.eclipse.jetty.websocket.", // WebSocket is a jetty extension + "org.eclipse.jetty.servlet.DefaultServlet" // webapp cannot change default servlets } ; // Server classes are classes that are hidden from being @@ -120,8 +124,12 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL // it has to include them in its distribution. public final static String[] __dftServerClasses = { - "-org.eclipse.jetty.servlet.listener.", // don't hide listeners use in webdefault.xml + "-org.eclipse.jetty.continuation.", // don't hide continuation classes + "-org.eclipse.jetty.jndi.", // don't hide naming classes + "-org.eclipse.jetty.jaas.", // don't hide jaas classes + "-org.eclipse.jetty.servlets.", // don't hide jetty servlets "-org.eclipse.jetty.servlet.DefaultServlet", // don't hide default servlet + "-org.eclipse.jetty.servlet.listener.", // don't hide useful listeners "org.eclipse.jetty." // hide other jetty classes } ; diff --git a/jetty-websocket/websocket-servlet/pom.xml b/jetty-websocket/websocket-servlet/pom.xml index 1baa4d1b121..9a991924728 100644 --- a/jetty-websocket/websocket-servlet/pom.xml +++ b/jetty-websocket/websocket-servlet/pom.xml @@ -19,7 +19,6 @@ org.eclipse.jetty.websocket websocket-api ${project.version} - provided org.eclipse.jetty.orbit diff --git a/tests/test-webapps/test-jetty-webapp/pom.xml b/tests/test-webapps/test-jetty-webapp/pom.xml index c297e3d1fc5..68802495b59 100644 --- a/tests/test-webapps/test-jetty-webapp/pom.xml +++ b/tests/test-webapps/test-jetty-webapp/pom.xml @@ -24,7 +24,6 @@ ../pom.xml 4.0.0 - org.eclipse.jetty test-jetty-webapp Test :: Jetty Test Webapp war @@ -184,7 +183,20 @@ org.eclipse.jetty jetty-servlets ${project.version} - provided + + + org.eclipse.jetty + jetty-util + + + org.eclipse.jetty + jetty-client + + + org.eclipse.jetty + jetty-http + + org.eclipse.jetty.orbit @@ -200,7 +212,20 @@ org.eclipse.jetty.websocket websocket-server ${project.version} - provided + + + org.eclipse.jetty + jetty-util + + + org.eclipse.jetty + jetty-http + + + org.eclipse.jetty + jetty-io + + org.eclipse.jetty diff --git a/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml b/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml index 687f31539f5..ca48bb7ac9a 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml +++ b/tests/test-webapps/test-jetty-webapp/src/main/webapp/WEB-INF/jetty-web.xml @@ -11,9 +11,6 @@ org.eclipse.jetty.servlet.WebApplicationContext object -org.eclipse.jetty.util. -org.eclipse.jetty.servlets. - -org.eclipse.jetty.websocket. - -org.eclipse.jetty.servlets. - -org.eclipse.jetty.servlet.listener. test webapp is deployed. DO NOT USE IN PRODUCTION! diff --git a/tests/test-webapps/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java b/tests/test-webapps/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java index 5ecafdc7414..75f1580c663 100644 --- a/tests/test-webapps/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java +++ b/tests/test-webapps/test-jetty-webapp/src/test/java/org/eclipse/jetty/TestServer.java @@ -67,7 +67,7 @@ public class TestServer { ((StdErrLog)Log.getLog()).setSource(false); - String jetty_root = "../../.."; + String jetty_root = ".."; // Setup Threadpool QueuedThreadPool threadPool = new QueuedThreadPool(); @@ -153,7 +153,7 @@ public class TestServer HashLoginService login = new HashLoginService(); login.setName("Test Realm"); - login.setConfig(jetty_root + "/tests/test-webapps/test-jetty-webapp/src/main/config/etc/realm.properties"); + login.setConfig(jetty_root + "/test-jetty-webapp/src/main/config/etc/realm.properties"); server.addBean(login); File log=File.createTempFile("jetty-yyyy_mm_dd", "log"); @@ -165,8 +165,8 @@ public class TestServer server.setSendServerVersion(true); WebAppContext webapp = new WebAppContext(); - // webapp.setParentLoaderPriority(true); - // webapp.prependServerClass("-org.eclipse.jetty.websocket.server."); + webapp.setParentLoaderPriority(true); + webapp.prependServerClass("-org.eclipse.jetty.websocket.server."); webapp.setResourceBase("./src/main/webapp"); webapp.setAttribute("testAttribute","testValue"); File sessiondir=File.createTempFile("sessions",null);