Instead of making the developer add the Weld Servle listener in their web.xml when using weld-servlet, might we consider registering it for them automatically but including it in a web.xml fragment or TLD that's bundled in weld-servlet.jar? The benefit of using the TLD is that it would work in pre-Servlet 3.0 environments.<div>
<br></div><div>META-INF/web-fragment.xml</div><div><div><web-fragment xmlns="<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a>"</div><div> xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"</div>
<div> xsi:schemaLocation="<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a> <a href="http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd">http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd</a>"</div>
<div> version="3.0"></div><div> <listener></div><div> <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class></div><div> </listener></div><div></web-fragment></div>
<div><br></div><div>META-INF/weld.tld</div><div><div><taglib xmlns="<a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a>"</div><div> xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>"</div>
<div> xsi:schemaLocation="</div><div> <a href="http://java.sun.com/xml/ns/javaee">http://java.sun.com/xml/ns/javaee</a></div><div> <a href="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_0.xsd">http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_0.xsd</a>"</div>
<div> version="2.0"></div><div> <description></div><div> An empty tag library that registers a listener to bootstrap Weld in a Servlet container.</div><div> </description></div><div>
<tlib-version>1.0</tlib-version></div><div> <short-name>w</short-name></div><div> <uri><a href="http://jboss.org/weld">http://jboss.org/weld</a></uri></div><div><br></div><div>
<!--</div><div> This ServletContextListener initializes the runtime environment of the CDI</div><div> Reference Implementation (Weld) when a web application including it is</div><div> initialized by the container.</div>
<div> --></div><div> <listener></div><div> <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class></div><div> </listener></div><div></taglib></div></div>
<div><br></div><div>Btw, we are already including other automatic configurations, such as a JSF phase listener and view handler (META-INF/faces-config.xml).</div><div><br></div><div>Worthy of a JIRA?</div><div><br></div><div>
-Dan</div><br>-- <br>Dan Allen<br>Principal Software Engineer, Red Hat | Author of Seam in Action<br>Registered Linux User #231597<br><br><a href="http://mojavelinux.com" target="_blank">http://mojavelinux.com</a><br><a href="http://mojavelinux.com/seaminaction" target="_blank">http://mojavelinux.com/seaminaction</a><br>
<a href="http://www.google.com/profiles/dan.j.allen" target="_blank">http://www.google.com/profiles/dan.j.allen</a><br>
</div>