adding web overrides for mojarra and myfaces

git-svn-id: https://svn.apache.org/repos/asf/myfaces/extensions/scripting/trunk@1414703 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/extscript-core-root/extscript-mojarra/src/main/java/org/apache/myfaces/extensions/scripting/mojarra/common/ClassLoaderUtils.java b/extscript-core-root/extscript-mojarra/src/main/java/org/apache/myfaces/extensions/scripting/mojarra/common/ClassLoaderUtils.java
index b0f7565..447b928 100644
--- a/extscript-core-root/extscript-mojarra/src/main/java/org/apache/myfaces/extensions/scripting/mojarra/common/ClassLoaderUtils.java
+++ b/extscript-core-root/extscript-mojarra/src/main/java/org/apache/myfaces/extensions/scripting/mojarra/common/ClassLoaderUtils.java
@@ -28,8 +28,8 @@
 
 public class ClassLoaderUtils extends org.apache.myfaces.extensions.scripting.core.common.util.ClassLoaderUtils
 {
+    static ClassLoader _oldClassLoader = null;
 
-    static ClassLoader oldClassLoader = null;
     public static void registerThrowAwayClassloader()
     {
         //we do not have the luxury of a pluggable classloading extensions like in myfaces
@@ -47,11 +47,11 @@
             return;
         }
         //in case of an unchanged classloader we can recycle our old throw away classloader
-        if(oldClassLoader != null && loader.equals(oldClassLoader.getParent())) {
-            Thread.currentThread().setContextClassLoader(oldClassLoader);
+        if(_oldClassLoader != null && loader.equals(_oldClassLoader.getParent())) {
+            Thread.currentThread().setContextClassLoader(_oldClassLoader);
         } else {
-            oldClassLoader = new ThrowAwayClassloader(loader);
-            Thread.currentThread().setContextClassLoader(oldClassLoader);
+            _oldClassLoader = new ThrowAwayClassloader(loader);
+            Thread.currentThread().setContextClassLoader(_oldClassLoader);
         }
     }
 
diff --git a/extscript-examples/blog-example/src/main/mojarra/override-web.xml b/extscript-examples/blog-example/src/main/mojarra/override-web.xml
new file mode 100644
index 0000000..4a3a00e
--- /dev/null
+++ b/extscript-examples/blog-example/src/main/mojarra/override-web.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <listener>
+        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+    </listener>
+
+</web-app>
\ No newline at end of file
diff --git a/extscript-examples/blog-example/src/main/myfaces/override-web.xml b/extscript-examples/blog-example/src/main/myfaces/override-web.xml
new file mode 100644
index 0000000..0de7708
--- /dev/null
+++ b/extscript-examples/blog-example/src/main/myfaces/override-web.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <listener>
+        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+    </listener>
+</web-app>
\ No newline at end of file
diff --git a/extscript-examples/cdi-example/src/main/mojarra/override-web.xml b/extscript-examples/cdi-example/src/main/mojarra/override-web.xml
new file mode 100644
index 0000000..4a3a00e
--- /dev/null
+++ b/extscript-examples/cdi-example/src/main/mojarra/override-web.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <listener>
+        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+    </listener>
+
+</web-app>
\ No newline at end of file
diff --git a/extscript-examples/cdi-example/src/main/myfaces/override-web.xml b/extscript-examples/cdi-example/src/main/myfaces/override-web.xml
new file mode 100644
index 0000000..0de7708
--- /dev/null
+++ b/extscript-examples/cdi-example/src/main/myfaces/override-web.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <listener>
+        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+    </listener>
+</web-app>
\ No newline at end of file
diff --git a/extscript-examples/myfaces20-example/src/main/mojarra/override-web.xml b/extscript-examples/myfaces20-example/src/main/mojarra/override-web.xml
new file mode 100644
index 0000000..4a3a00e
--- /dev/null
+++ b/extscript-examples/myfaces20-example/src/main/mojarra/override-web.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <listener>
+        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+    </listener>
+
+</web-app>
\ No newline at end of file
diff --git a/extscript-examples/myfaces20-example/src/main/myfaces/override-web.xml b/extscript-examples/myfaces20-example/src/main/myfaces/override-web.xml
new file mode 100644
index 0000000..0de7708
--- /dev/null
+++ b/extscript-examples/myfaces20-example/src/main/myfaces/override-web.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <listener>
+        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+    </listener>
+</web-app>
\ No newline at end of file
diff --git a/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml b/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml
index 4e531a2..533b988 100644
--- a/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml
+++ b/extscript-examples/myfaces20-example/src/main/webapp/WEB-INF/web.xml
@@ -151,18 +151,6 @@
 
     <!-- Listener, to allow Jetty serving MyFaces apps -->
 
-    <!--
-    <listener>
-        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
-    </listener>
-    -->
-
-    <listener>
-        <listener-class>
-            com.sun.faces.config.ConfigureListener
-        </listener-class>
-    </listener>
-
     <!-- Faces Servlet -->
     <servlet>
         <servlet-name>Faces Servlet</servlet-name>
diff --git a/extscript-examples/myfaces20-extscript-helloworld/src/main/mojarra/override-web.xml b/extscript-examples/myfaces20-extscript-helloworld/src/main/mojarra/override-web.xml
new file mode 100644
index 0000000..4a3a00e
--- /dev/null
+++ b/extscript-examples/myfaces20-extscript-helloworld/src/main/mojarra/override-web.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <listener>
+        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+    </listener>
+
+</web-app>
\ No newline at end of file
diff --git a/extscript-examples/myfaces20-extscript-helloworld/src/main/myfaces/override-web.xml b/extscript-examples/myfaces20-extscript-helloworld/src/main/myfaces/override-web.xml
new file mode 100644
index 0000000..0de7708
--- /dev/null
+++ b/extscript-examples/myfaces20-extscript-helloworld/src/main/myfaces/override-web.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <listener>
+        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+    </listener>
+</web-app>
\ No newline at end of file
diff --git a/extscript-examples/pom.xml b/extscript-examples/pom.xml
index 18ddfd2..3d84876 100644
--- a/extscript-examples/pom.xml
+++ b/extscript-examples/pom.xml
@@ -61,21 +61,7 @@
                     <port>9080</port>
                 </configuration>
             </plugin>
-            <plugin>
-                <groupId>org.mortbay.jetty</groupId>
-                <artifactId>jetty-maven-plugin</artifactId>
-                <version>8.1.2.v20120308</version>
-                <configuration>
-                    <connectors>
-                        <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
-                            <port>9090</port>
-                            <maxIdleTime>60000</maxIdleTime>
-                        </connector>
-                    </connectors>
-                    <scanIntervalSeconds>1</scanIntervalSeconds>
 
-                </configuration>
-            </plugin>
             <!-- tomcat plugin as alternative testing ground -->
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
@@ -111,6 +97,89 @@
             <properties>
                 <maven.war.webxml>${basedir}/src/main/conf/dev/web.xml</maven.war.webxml>
             </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.mortbay.jetty</groupId>
+                        <artifactId>jetty-maven-plugin</artifactId>
+                        <version>8.1.2.v20120308</version>
+                        <configuration>
+                            <connectors>
+                                <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
+                                    <port>9090</port>
+                                    <maxIdleTime>60000</maxIdleTime>
+                                </connector>
+                            </connectors>
+                            <scanIntervalSeconds>1</scanIntervalSeconds>
+                            <webAppConfig>
+                                <overrideDescriptor>
+                                    src/main/myfaces/override-myfaces-web.xml
+                                </overrideDescriptor>
+                            </webAppConfig>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <!-- we use different profiles for jetty and myfaces so that their respective listeners are fetched -->
+        <profile>
+            <id>myfaces</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.mortbay.jetty</groupId>
+                        <artifactId>jetty-maven-plugin</artifactId>
+                        <version>8.1.2.v20120308</version>
+                        <configuration>
+                            <connectors>
+                                <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
+                                    <port>9090</port>
+                                    <maxIdleTime>60000</maxIdleTime>
+                                </connector>
+                            </connectors>
+                            <scanIntervalSeconds>1</scanIntervalSeconds>
+                            <webAppConfig>
+                                <overrideDescriptor>
+                                    src/main/myfaces/override-web.xml
+                                </overrideDescriptor>
+                            </webAppConfig>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>mojarra</id>
+            <activation>
+                <activeByDefault>false</activeByDefault>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.mortbay.jetty</groupId>
+                        <artifactId>jetty-maven-plugin</artifactId>
+                        <version>8.1.2.v20120308</version>
+                        <configuration>
+                            <connectors>
+                                <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
+                                    <port>9090</port>
+                                    <maxIdleTime>60000</maxIdleTime>
+                                </connector>
+                            </connectors>
+                            <scanIntervalSeconds>1</scanIntervalSeconds>
+                            <webAppConfig>
+                                <overrideDescriptor>
+                                    src/main/mojarra/override-web.xml
+                                </overrideDescriptor>
+                            </webAppConfig>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
         </profile>
     </profiles>
 
diff --git a/extscript-examples/spring-example/src/main/mojarra/override-web.xml b/extscript-examples/spring-example/src/main/mojarra/override-web.xml
new file mode 100644
index 0000000..4a3a00e
--- /dev/null
+++ b/extscript-examples/spring-example/src/main/mojarra/override-web.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <listener>
+        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+    </listener>
+
+</web-app>
\ No newline at end of file
diff --git a/extscript-examples/spring-example/src/main/myfaces/override-web.xml b/extscript-examples/spring-example/src/main/myfaces/override-web.xml
new file mode 100644
index 0000000..0de7708
--- /dev/null
+++ b/extscript-examples/spring-example/src/main/myfaces/override-web.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <listener>
+        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+    </listener>
+</web-app>
\ No newline at end of file
diff --git a/extscript-examples/weld-example/src/main/mojarra/override-web.xml b/extscript-examples/weld-example/src/main/mojarra/override-web.xml
new file mode 100644
index 0000000..4a3a00e
--- /dev/null
+++ b/extscript-examples/weld-example/src/main/mojarra/override-web.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <listener>
+        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
+    </listener>
+
+</web-app>
\ No newline at end of file
diff --git a/extscript-examples/weld-example/src/main/myfaces/override-web.xml b/extscript-examples/weld-example/src/main/myfaces/override-web.xml
new file mode 100644
index 0000000..0de7708
--- /dev/null
+++ b/extscript-examples/weld-example/src/main/myfaces/override-web.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+         version="3.0">
+    <listener>
+        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
+    </listener>
+</web-app>
\ No newline at end of file