You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/11/05 20:27:20 UTC

svn commit: r1031736 - /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java

Author: lu4242
Date: Fri Nov  5 19:27:20 2010
New Revision: 1031736

URL: http://svn.apache.org/viewvc?rev=1031736&view=rev
Log:
MYFACES-2944 Make those add*** methods public in WebXml

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java?rev=1031736&r1=1031735&r2=1031736&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/webapp/AbstractFacesInitializer.java Fri Nov  5 19:27:20 2010
@@ -31,6 +31,8 @@ import org.apache.myfaces.shared_impl.co
 import org.apache.myfaces.shared_impl.util.StateUtils;
 import org.apache.myfaces.shared_impl.util.WebConfigParamUtils;
 import org.apache.myfaces.shared_impl.webapp.webxml.WebXml;
+import org.apache.myfaces.spi.WebConfigProvider;
+import org.apache.myfaces.spi.WebConfigProviderFactory;
 import org.apache.myfaces.view.facelets.tag.MetaRulesetImpl;
 
 import javax.el.ExpressionFactory;
@@ -103,15 +105,10 @@ public abstract class AbstractFacesIniti
             
             if (!WebConfigParamUtils.getBooleanInitParameter(externalContext, INITIALIZE_ALWAYS_STANDALONE, false))
             {
-                WebXml webXml = WebXml.getWebXml(externalContext);
-                if (webXml == null) {
-                    if (log.isLoggable(Level.WARNING)) {
-                        log.warning("Couldn't find the web.xml configuration file. "
-                                 + "Abort initializing MyFaces.");
-                    }
-    
-                    return;
-                } else if (webXml.getFacesServletMappings().isEmpty()) {
+                WebConfigProvider webConfigProvider = WebConfigProviderFactory.getWebXmlProviderFactory(
+                        facesContext.getExternalContext()).getWebXmlProvider(facesContext.getExternalContext());
+
+                if (webConfigProvider.getFacesServletMappings(facesContext.getExternalContext()).isEmpty()) {
                     // check if the FacesServlet has been added dynamically
                     // in a Servlet 3.0 environment by MyFacesContainerInitializer
                     Boolean mappingAdded = (Boolean) servletContext.getAttribute(FACES_SERVLET_ADDED_ATTRIBUTE);
@@ -261,15 +258,10 @@ public abstract class AbstractFacesIniti
         if (!WebConfigParamUtils.getBooleanInitParameter(facesContext.getExternalContext(), INITIALIZE_ALWAYS_STANDALONE, false))
         {
             //We need to check if the current application was initialized by myfaces
-            WebXml webXml = WebXml.getWebXml(facesContext.getExternalContext());
-            if (webXml == null) {
-                if (log.isLoggable(Level.WARNING)) {
-                    log.warning("Couldn't find the web.xml configuration file. "
-                             + "Abort destroy MyFaces.");
-                }
-    
-                return;
-            } else if (webXml.getFacesServletMappings().isEmpty()) {
+            WebConfigProvider webConfigProvider = WebConfigProviderFactory.getWebXmlProviderFactory(
+                    facesContext.getExternalContext()).getWebXmlProvider(facesContext.getExternalContext());
+            
+            if (webConfigProvider.getFacesServletMappings(facesContext.getExternalContext()).isEmpty()) {
                 // check if the FacesServlet has been added dynamically
                 // in a Servlet 3.0 environment by MyFacesContainerInitializer
                 Boolean mappingAdded = (Boolean) servletContext.getAttribute(FACES_SERVLET_ADDED_ATTRIBUTE);