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.
META-INF/web-fragment.xml <web-fragment 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-fragment_3_0.xsd" version="3.0"> <listener> <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class> </listener> </web-fragment> META-INF/weld.tld <taglib 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-jsptaglibrary_2_0.xsd" version="2.0"> <description> An empty tag library that registers a listener to bootstrap Weld in a Servlet container. </description> <tlib-version>1.0</tlib-version> <short-name>w</short-name> <uri>http://jboss.org/weld</uri> <!-- This ServletContextListener initializes the runtime environment of the CDI Reference Implementation (Weld) when a web application including it is initialized by the container. --> <listener> <listener-class>org.jboss.weld.environment.servlet.Listener</listener-class> </listener> </taglib> Btw, we are already including other automatic configurations, such as a JSF phase listener and view handler (META-INF/faces-config.xml). Worthy of a JIRA? -Dan -- Dan Allen Principal Software Engineer, Red Hat | Author of Seam in Action Registered Linux User #231597 http://mojavelinux.com http://mojavelinux.com/seaminaction http://www.google.com/profiles/dan.j.allen
_______________________________________________ weld-dev mailing list [email protected] https://lists.jboss.org/mailman/listinfo/weld-dev
