myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthias Wessendorf <>
Subject MYFACES-2952 - Improve Atmosphere Meteor support of MyFaces
Date Fri, 29 Oct 2010 10:41:55 GMT
Currently MyFaces stops initializing when there is no (My)FacesServlet
configured in the (present) web.xml.

I am sure this is in 99.99% of all cases right. However there is a
chance that a "wrapping" framework will
instantiate the (My)FacesServlet, inside a wrapping Servlet.

An example of that is the WebSocket/Comet Framework Atmosphere.
As mentioned in [1] a typical configuration looks like:


So in order to enable the to see that it
can continue the initialization work, I thought about adding the
following to shared

Index: src/main/java/org/apache/myfaces/shared/webapp/webxml/
--- src/main/java/org/apache/myfaces/shared/webapp/webxml/	(revision
+++ src/main/java/org/apache/myfaces/shared/webapp/webxml/	(working
@@ -107,6 +107,11 @@
     public abstract boolean isErrorPagePresent();

+     * Determines, if the web.xml contains the Atmosphere Meteor Servlet
+     */
+    public abstract boolean isAtmosphereMeteorServletPresent();
+    /**
      * Returns true if the given servlet class is a valid FacesServlet.
      * This is the FacesServlet itself or any DelegatedFacesServlet.

The AbstractFacesInitializer would be changed to something like:

Index: impl/src/main/java/org/apache/myfaces/webapp/
--- impl/src/main/java/org/apache/myfaces/webapp/	(revision
+++ impl/src/main/java/org/apache/myfaces/webapp/	(working
@@ -79,6 +79,7 @@
      * application.
     public void initFaces(ServletContext servletContext) {
         try {
             if (log.isLoggable(Level.FINEST)) {
                 log.finest("Initializing MyFaces");
@@ -102,7 +103,9 @@

-            } else if (webXml.getFacesServletMappings().isEmpty()) {
+            } else if (webXml.getFacesServletMappings().isEmpty() &&
!webXml.isAtmosphereMeteorServletPresent()) {
+                // IF the
                 // check if the FacesServlet has been added dynamically
                 // in a Servlet 3.0 environment by MyFacesContainerInitializer
                 Boolean mappingAdded = (Boolean)

What do you think?

Note....of course - today we have Atmoshpere, tomorrow we may have
different use cases to see if a different Servlet (and/or Filter) is
Hence we could have something like instead:
public abstract boolean containsServlet(String fullQualifiedClassName);

(we want String here, since (with Atmosphere) we can't compile against
it (->(L)GPL))... but we can use the String-based name
as a constant in our code....)

Oh yes... a similar change would be needed for the from our implee6 module.



Matthias Wessendorf


View raw message