Permalink
Browse files

Remove the need for jetty-web.xml.

  • Loading branch information...
1 parent d177bf6 commit 4fe5e292e0ce770b618012e47a40515d5fe441ab @alesj alesj committed Oct 21, 2011
@@ -70,6 +70,12 @@
</dependency>
<dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-plus</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<scope>provided</scope>
@@ -88,6 +94,12 @@
</dependency>
<dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-plus</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<scope>provided</scope>
@@ -6,6 +6,7 @@
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.servlet.ServletHandler;
+import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.webapp.WebAppContext;
import javax.servlet.Filter;
@@ -59,6 +60,14 @@ protected static void process(WebAppContext wac, boolean startNewHandler) throws
if (startNewHandler)
wHanlder.start();
+
+ Resource jettyEnv = null;
+ Resource webInf = wac.getWebInf();
+ if (webInf != null && webInf.exists()) {
+ jettyEnv = webInf.addPath("jetty-env.xml");
+ }
+ if (jettyEnv == null || jettyEnv.exists() == false)
+ log.warning("Missing jetty-env.xml, no BeanManager present in JNDI.");
}
public static void process(WebAppContext wac) throws Exception {
@@ -6,6 +6,7 @@
import org.mortbay.jetty.handler.HandlerCollection;
import org.mortbay.jetty.servlet.ServletHandler;
import org.mortbay.jetty.webapp.WebAppContext;
+import org.mortbay.resource.Resource;
import javax.servlet.Filter;
import javax.servlet.Servlet;
@@ -60,6 +61,14 @@ protected static void process(WebAppContext wac, boolean startNewHandler) throws
if (startNewHandler)
wHanlder.start();
+
+ Resource jettyEnv = null;
+ Resource webInf = wac.getWebInf();
+ if (webInf != null && webInf.exists()) {
+ jettyEnv = webInf.addPath("jetty-env.xml");
+ }
+ if (jettyEnv == null || jettyEnv.exists() == false)
+ log.warning("Missing jetty-env.xml, no BeanManager present in JNDI.");
}
public static void process(WebAppContext wac) throws Exception {
@@ -6,16 +6,14 @@
import org.junit.runner.RunWith;
import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_ENV;
-import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_WEB;
@RunWith(Arquillian.class)
public class BootstrapOrderingTest extends BootstrapOrderingTestBase {
@Deployment
public static WebArchive deployment() {
return BootstrapOrderingTestBase.deployment()
- .addAsWebInfResource(JETTY_ENV, "jetty-env.xml")
- .addAsWebInfResource(JETTY_WEB, "jetty-web.xml");
+ .addAsWebInfResource(JETTY_ENV, "jetty-env.xml");
}
}
@@ -6,16 +6,14 @@
import org.junit.runner.RunWith;
import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_ENV;
-import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_WEB;
@RunWith(Arquillian.class)
public class DeploymentOrderingTest extends DeploymentOrderingTestBase {
@Deployment
public static WebArchive deployment() {
return DeploymentOrderingTestBase.deployment()
- .addAsWebInfResource(JETTY_ENV, "jetty-env.xml")
- .addAsWebInfResource(JETTY_WEB, "jetty-web.xml");
+ .addAsWebInfResource(JETTY_ENV, "jetty-env.xml");
}
}
@@ -6,16 +6,14 @@
import org.junit.runner.RunWith;
import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_ENV;
-import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_WEB;
@RunWith(Arquillian.class)
public class JsfTest extends JsfTestBase {
@Deployment(testable = false)
public static WebArchive deployment() {
return JsfTestBase.deployment()
- .addAsWebInfResource(JETTY_ENV, "jetty-env.xml")
- .addAsWebInfResource(JETTY_WEB, "jetty-web.xml");
+ .addAsWebInfResource(JETTY_ENV, "jetty-env.xml");
}
}
@@ -6,14 +6,13 @@
import org.junit.runner.RunWith;
import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_ENV;
-import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_WEB;
@RunWith(Arquillian.class)
public class ExampleTest extends ExampleTestBase {
@Deployment
public static WebArchive deployment() {
- return ExampleTestBase.deployment().addAsWebInfResource(JETTY_ENV, "jetty-env.xml").addAsWebInfResource(JETTY_WEB, "jetty-web.xml");
+ return ExampleTestBase.deployment().addAsWebInfResource(JETTY_ENV, "jetty-env.xml");
}
}
@@ -6,14 +6,13 @@
import org.junit.runner.RunWith;
import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_ENV;
-import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_WEB;
@RunWith(Arquillian.class)
public class MockExampleTest extends MockExampleTestBase {
@Deployment
public static WebArchive deployment() {
- return MockExampleTestBase.deployment().addAsWebInfResource(JETTY_ENV, "jetty-env.xml").addAsWebInfResource(JETTY_WEB, "jetty-web.xml");
+ return MockExampleTestBase.deployment().addAsWebInfResource(JETTY_ENV, "jetty-env.xml");
}
}
@@ -6,14 +6,13 @@
import org.junit.runner.RunWith;
import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_ENV;
-import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_WEB;
@RunWith(Arquillian.class)
public class FilterInjectionTest extends FilterInjectionTestBase {
@Deployment(testable = false)
public static WebArchive deployment() {
- return FilterInjectionTestBase.deployment().addAsWebInfResource(JETTY_ENV, "jetty-env.xml").addAsWebInfResource(JETTY_WEB, "jetty-web.xml");
+ return FilterInjectionTestBase.deployment().addAsWebInfResource(JETTY_ENV, "jetty-env.xml");
}
}
@@ -6,14 +6,13 @@
import org.junit.runner.RunWith;
import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_ENV;
-import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_WEB;
@RunWith(Arquillian.class)
public class ListenerInjectionTest extends ListenerInjectionTestBase {
@Deployment(testable = false)
public static WebArchive deployment() {
- return ListenerInjectionTestBase.deployment().addAsWebInfResource(JETTY_ENV, "jetty-env.xml").addAsWebInfResource(JETTY_WEB, "jetty-web.xml");
+ return ListenerInjectionTestBase.deployment().addAsWebInfResource(JETTY_ENV, "jetty-env.xml");
}
}
@@ -7,14 +7,13 @@
import org.junit.runner.RunWith;
import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_ENV;
-import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_WEB;
@RunWith(Arquillian.class)
public class LookupTest extends LookupTestBase {
@Deployment
public static WebArchive deployment() {
- return LookupTestBase.deployment().addAsWebInfResource(JETTY_ENV, "jetty-env.xml").addAsWebInfResource(JETTY_WEB, "jetty-web.xml");
+ return LookupTestBase.deployment().addAsWebInfResource(JETTY_ENV, "jetty-env.xml");
}
}
@@ -6,14 +6,13 @@
import org.junit.runner.RunWith;
import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_ENV;
-import static org.jboss.weld.environment.servlet.test.util.JettyDeployments.JETTY_WEB;
@RunWith(Arquillian.class)
public class ServletInjectionTest extends ServletInjectionTestBase {
@Deployment(testable = false)
public static WebArchive deployment() {
- return ServletInjectionTestBase.deployment().addAsWebInfResource(JETTY_ENV, "jetty-env.xml").addAsWebInfResource(JETTY_WEB, "jetty-web.xml");
+ return ServletInjectionTestBase.deployment().addAsWebInfResource(JETTY_ENV, "jetty-env.xml");
}
}
@@ -5,7 +5,21 @@
public class JettyDeployments {
- public static final Asset JETTY_ENV = new StringAsset("<Configure id=\"webAppCtx\" class=\"org.mortbay.jetty.webapp.WebAppContext\"><New class=\"org.mortbay.jetty.plus.naming.EnvEntry\"><Arg><Ref id=\"webAppCtx\"/></Arg><Arg>BeanManager</Arg><Arg><New class=\"javax.naming.Reference\"><Arg>javax.enterprise.inject.spi.BeanManager</Arg><Arg>org.jboss.weld.resources.ManagerObjectFactory</Arg><Arg/></New></Arg><Arg type=\"boolean\">true</Arg></New></Configure>");
+ public static final Asset JETTY_ENV = new StringAsset("" +
+ "<Configure id=\"webAppCtx\" class=\"org.mortbay.jetty.webapp.WebAppContext\">" +
+ "<New class=\"org.mortbay.jetty.plus.naming.EnvEntry\">" +
+ "<Arg><Ref id=\"webAppCtx\"/></Arg>" +
+ "<Arg>BeanManager</Arg>" +
+ "<Arg>" +
+ "<New class=\"javax.naming.Reference\">" +
+ "<Arg>javax.enterprise.inject.spi.BeanManager</Arg>" +
+ "<Arg>org.jboss.weld.resources.ManagerObjectFactory</Arg>" +
+ "<Arg/>" +
+ "</New>" +
+ "</Arg>" +
+ "<Arg type=\"boolean\">true</Arg>" +
+ "</New>" +
+ "</Configure>");
public static final Asset JETTY_WEB = new StringAsset("<Configure id=\"webAppCtx\" class=\"org.mortbay.jetty.webapp.WebAppContext\"><Call class=\"org.jboss.weld.environment.jetty.WeldServletHandler\" name=\"process\"><Arg><Ref id=\"webAppCtx\"/></Arg></Call></Configure>");

0 comments on commit 4fe5e29

Please sign in to comment.