jetty-9 cleaned up serverClasses to minimum
This commit is contained in:
parent
be816d853b
commit
67b5caadbb
|
@ -14,6 +14,7 @@
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-client</artifactId>
|
<artifactId>jetty-client</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
|
|
@ -18,6 +18,12 @@
|
||||||
<artifactId>example-async-rest-jar</artifactId>
|
<artifactId>example-async-rest-jar</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-client</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-webapp</artifactId>
|
<artifactId>jetty-webapp</artifactId>
|
||||||
|
|
|
@ -12,4 +12,7 @@ org.eclipse.jetty.servlet.WebApplicationContext object
|
||||||
<Get class="org.eclipse.jetty.util.log.Log" name="rootLogger">
|
<Get class="org.eclipse.jetty.util.log.Log" name="rootLogger">
|
||||||
<Call name="warn"><Arg>async-rest webapp is deployed. DO NOT USE IN PRODUCTION!</Arg></Call>
|
<Call name="warn"><Arg>async-rest webapp is deployed. DO NOT USE IN PRODUCTION!</Arg></Call>
|
||||||
</Get>
|
</Get>
|
||||||
|
|
||||||
|
<Call name="prependServerClass"><Arg>-org.eclipse.jetty.client.</Arg></Call>
|
||||||
|
|
||||||
</Configure>
|
</Configure>
|
||||||
|
|
|
@ -33,8 +33,6 @@ public class DemoServer
|
||||||
WebAppContext webapp = new WebAppContext();
|
WebAppContext webapp = new WebAppContext();
|
||||||
webapp.setContextPath("/");
|
webapp.setContextPath("/");
|
||||||
webapp.setWar(jetty_home+"/target/async-rest/");
|
webapp.setWar(jetty_home+"/target/async-rest/");
|
||||||
webapp.setParentLoaderPriority(true);
|
|
||||||
webapp.setServerClasses(new String[]{});
|
|
||||||
server.setHandler(webapp);
|
server.setHandler(webapp);
|
||||||
|
|
||||||
server.start();
|
server.start();
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
</Arg>
|
</Arg>
|
||||||
</Call> -->
|
</Call> -->
|
||||||
|
|
||||||
<Call id="webappprovider" name="addAppProvider">
|
<Call id="webappProvider" name="addAppProvider">
|
||||||
<Arg>
|
<Arg>
|
||||||
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
|
<New class="org.eclipse.jetty.deploy.providers.WebAppProvider">
|
||||||
<Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
|
<Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set>
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-util</artifactId>
|
<artifactId>jetty-util</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jetty.orbit</groupId>
|
<groupId>org.eclipse.jetty.orbit</groupId>
|
||||||
|
|
|
@ -1854,12 +1854,19 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
||||||
|
|
||||||
((WebDescriptor)descriptor).addClassName(className);
|
((WebDescriptor)descriptor).addClassName(className);
|
||||||
|
|
||||||
Class<? extends EventListener> listenerClass = (Class<? extends EventListener>)context.loadClass(className);
|
Class<?> listenerClass = context.loadClass(className);
|
||||||
listener = newListenerInstance(context,listenerClass);
|
if (listenerClass==null)
|
||||||
if (!(listener instanceof EventListener))
|
|
||||||
{
|
{
|
||||||
LOG.warn("Not an EventListener: " + listener);
|
throw new RuntimeException("Could not Load EventListener: " + className);
|
||||||
return;
|
}
|
||||||
|
if (!(EventListener.class.isAssignableFrom(listenerClass)))
|
||||||
|
{
|
||||||
|
throw new RuntimeException("Not an EventListener: " + className);
|
||||||
|
}
|
||||||
|
listener = newListenerInstance(context,(Class<? extends EventListener>)listenerClass);
|
||||||
|
if (listener==null)
|
||||||
|
{
|
||||||
|
throw new RuntimeException("Could not Load EventListener: " + className);
|
||||||
}
|
}
|
||||||
context.addEventListener(listener);
|
context.addEventListener(listener);
|
||||||
context.getMetaData().setOrigin(className+".listener", descriptor);
|
context.getMetaData().setOrigin(className+".listener", descriptor);
|
||||||
|
@ -1868,8 +1875,7 @@ public class StandardDescriptorProcessor extends IterativeDescriptorProcessor
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOG.warn("Could not instantiate listener " + className, e);
|
throw new RuntimeException("Could not instantiate listener " + className, e);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,18 +104,14 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||||
|
|
||||||
// System classes are classes that cannot be replaced by
|
// System classes are classes that cannot be replaced by
|
||||||
// the web application, and they are *always* loaded via
|
// the web application, and they are *always* loaded via
|
||||||
// system classloader.
|
// system classloader if possible
|
||||||
public final static String[] __dftSystemClasses =
|
public final static String[] __dftSystemClasses =
|
||||||
{
|
{
|
||||||
"java.", // Java SE classes (per servlet spec v2.5 / SRV.9.7.2)
|
"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)
|
"javax.", // Java SE classes (per servlet spec v2.5 / SRV.9.7.2)
|
||||||
"org.xml.", // needed by javax.xml
|
"org.xml.", // needed by javax.xml
|
||||||
"org.w3c.", // needed by javax.xml
|
"org.w3c.", // needed by javax.xml
|
||||||
"org.eclipse.jetty.continuation.", // webapp cannot change continuation classes
|
"org.eclipse.jetty.", // webapp cannot change jetty 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
|
// Server classes are classes that are hidden from being
|
||||||
|
@ -124,12 +120,8 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
||||||
// it has to include them in its distribution.
|
// it has to include them in its distribution.
|
||||||
public final static String[] __dftServerClasses =
|
public final static String[] __dftServerClasses =
|
||||||
{
|
{
|
||||||
"-org.eclipse.jetty.continuation.", // don't hide continuation classes
|
"-org.eclipse.jetty.servlet.listener.", // don't hide listeners use in webdefault.xml
|
||||||
"-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.DefaultServlet", // don't hide default servlet
|
||||||
"-org.eclipse.jetty.servlet.listener.", // don't hide useful listeners
|
|
||||||
"org.eclipse.jetty." // hide other jetty classes
|
"org.eclipse.jetty." // hide other jetty classes
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<groupId>org.eclipse.jetty.websocket</groupId>
|
<groupId>org.eclipse.jetty.websocket</groupId>
|
||||||
<artifactId>websocket-api</artifactId>
|
<artifactId>websocket-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jetty.orbit</groupId>
|
<groupId>org.eclipse.jetty.orbit</groupId>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>test-jetty-webapp</artifactId>
|
<artifactId>test-jetty-webapp</artifactId>
|
||||||
<name>Test :: Jetty Test Webapp</name>
|
<name>Test :: Jetty Test Webapp</name>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
@ -183,20 +184,7 @@
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
<artifactId>jetty-servlets</artifactId>
|
<artifactId>jetty-servlets</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<exclusions>
|
<scope>provided</scope>
|
||||||
<exclusion>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-util</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-client</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-http</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jetty.orbit</groupId>
|
<groupId>org.eclipse.jetty.orbit</groupId>
|
||||||
|
@ -212,20 +200,7 @@
|
||||||
<groupId>org.eclipse.jetty.websocket</groupId>
|
<groupId>org.eclipse.jetty.websocket</groupId>
|
||||||
<artifactId>websocket-server</artifactId>
|
<artifactId>websocket-server</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<exclusions>
|
<scope>provided</scope>
|
||||||
<exclusion>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-util</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-http</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-io</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
|
|
@ -11,6 +11,9 @@ org.eclipse.jetty.servlet.WebApplicationContext object
|
||||||
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
|
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
|
||||||
<Call name="prependServerClass"><Arg>-org.eclipse.jetty.util.</Arg></Call>
|
<Call name="prependServerClass"><Arg>-org.eclipse.jetty.util.</Arg></Call>
|
||||||
<Call name="prependServerClass"><Arg>-org.eclipse.jetty.servlets.</Arg></Call>
|
<Call name="prependServerClass"><Arg>-org.eclipse.jetty.servlets.</Arg></Call>
|
||||||
|
<Call name="prependServerClass"><Arg>-org.eclipse.jetty.websocket.</Arg></Call>
|
||||||
|
<Call name="prependServerClass"><Arg>-org.eclipse.jetty.servlets.</Arg></Call>
|
||||||
|
<Call name="prependServerClass"><Arg>-org.eclipse.jetty.servlet.listener.</Arg></Call>
|
||||||
<Get class="org.eclipse.jetty.util.log.Log" name="rootLogger">
|
<Get class="org.eclipse.jetty.util.log.Log" name="rootLogger">
|
||||||
<Call name="warn"><Arg>test webapp is deployed. DO NOT USE IN PRODUCTION!</Arg></Call>
|
<Call name="warn"><Arg>test webapp is deployed. DO NOT USE IN PRODUCTION!</Arg></Call>
|
||||||
</Get>
|
</Get>
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class TestServer
|
||||||
{
|
{
|
||||||
((StdErrLog)Log.getLog()).setSource(false);
|
((StdErrLog)Log.getLog()).setSource(false);
|
||||||
|
|
||||||
String jetty_root = "..";
|
String jetty_root = "../../..";
|
||||||
|
|
||||||
// Setup Threadpool
|
// Setup Threadpool
|
||||||
QueuedThreadPool threadPool = new QueuedThreadPool();
|
QueuedThreadPool threadPool = new QueuedThreadPool();
|
||||||
|
@ -153,7 +153,7 @@ public class TestServer
|
||||||
|
|
||||||
HashLoginService login = new HashLoginService();
|
HashLoginService login = new HashLoginService();
|
||||||
login.setName("Test Realm");
|
login.setName("Test Realm");
|
||||||
login.setConfig(jetty_root + "/test-jetty-webapp/src/main/config/etc/realm.properties");
|
login.setConfig(jetty_root + "/tests/test-webapps/test-jetty-webapp/src/main/config/etc/realm.properties");
|
||||||
server.addBean(login);
|
server.addBean(login);
|
||||||
|
|
||||||
File log=File.createTempFile("jetty-yyyy_mm_dd", "log");
|
File log=File.createTempFile("jetty-yyyy_mm_dd", "log");
|
||||||
|
@ -165,8 +165,8 @@ public class TestServer
|
||||||
server.setSendServerVersion(true);
|
server.setSendServerVersion(true);
|
||||||
|
|
||||||
WebAppContext webapp = new WebAppContext();
|
WebAppContext webapp = new WebAppContext();
|
||||||
webapp.setParentLoaderPriority(true);
|
// webapp.setParentLoaderPriority(true);
|
||||||
webapp.prependServerClass("-org.eclipse.jetty.websocket.server.");
|
// webapp.prependServerClass("-org.eclipse.jetty.websocket.server.");
|
||||||
webapp.setResourceBase("./src/main/webapp");
|
webapp.setResourceBase("./src/main/webapp");
|
||||||
webapp.setAttribute("testAttribute","testValue");
|
webapp.setAttribute("testAttribute","testValue");
|
||||||
File sessiondir=File.createTempFile("sessions",null);
|
File sessiondir=File.createTempFile("sessions",null);
|
||||||
|
|
Loading…
Reference in New Issue