Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove the need for jetty-web.xml.

  • Loading branch information...
commit 4fe5e292e0ce770b618012e47a40515d5fe441ab 1 parent d177bf6
@alesj alesj authored
Showing with 54 additions and 22 deletions.
  1. +12 −0 environments/servlet/core/pom.xml
  2. +9 −0 environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/EclipseWeldServletHandler.java
  3. +9 −0 environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/MortbayWeldServletHandler.java
  4. +1 −3 ...vlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/bootstrap/BootstrapOrderingTest.java
  5. +1 −3 ...etty/src/test/java/org/jboss/weld/environment/servlet/test/deployment/structure/DeploymentOrderingTest.java
  6. +1 −3 environments/servlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/el/JsfTest.java
  7. +1 −2  ...onments/servlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/examples/ExampleTest.java
  8. +1 −2  ...nts/servlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/examples/MockExampleTest.java
  9. +1 −2  ...ervlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/injection/FilterInjectionTest.java
  10. +1 −2  ...vlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/injection/ListenerInjectionTest.java
  11. +1 −2  ...onments/servlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/injection/LookupTest.java
  12. +1 −2  ...rvlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/injection/ServletInjectionTest.java
  13. +15 −1 ...nments/servlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/util/JettyDeployments.java
View
12 environments/servlet/core/pom.xml
@@ -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>
View
9 environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/EclipseWeldServletHandler.java
@@ -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 {
View
9 environments/servlet/core/src/main/java/org/jboss/weld/environment/jetty/MortbayWeldServletHandler.java
@@ -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 {
View
4 ...t/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/bootstrap/BootstrapOrderingTest.java
@@ -6,7 +6,6 @@
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 {
@@ -14,8 +13,7 @@
@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");
}
}
View
4 ...y/src/test/java/org/jboss/weld/environment/servlet/test/deployment/structure/DeploymentOrderingTest.java
@@ -6,7 +6,6 @@
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 {
@@ -14,8 +13,7 @@
@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");
}
}
View
4 environments/servlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/el/JsfTest.java
@@ -6,7 +6,6 @@
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 {
@@ -14,8 +13,7 @@
@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");
}
}
View
3  ...ents/servlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/examples/ExampleTest.java
@@ -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");
}
}
View
3  .../servlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/examples/MockExampleTest.java
@@ -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");
}
}
View
3  ...let/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/injection/FilterInjectionTest.java
@@ -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");
}
}
View
3  ...t/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/injection/ListenerInjectionTest.java
@@ -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");
}
}
View
3  ...ents/servlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/injection/LookupTest.java
@@ -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");
}
}
View
3  ...et/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/injection/ServletInjectionTest.java
@@ -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");
}
}
View
16 ...nts/servlet/tests/jetty/src/test/java/org/jboss/weld/environment/servlet/test/util/JettyDeployments.java
@@ -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>");
Please sign in to comment.
Something went wrong with that request. Please try again.