myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [myfaces] branch master updated: refactored
Date Mon, 17 Dec 2018 15:13:05 GMT
This is an automated email from the ASF dual-hosted git repository.

tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/master by this push:
     new f563aa2  refactored
f563aa2 is described below

commit f563aa230c3d654e833fb5a0328cf81261bbad16
Author: Thomas Andraschko <tandraschko@apache.org>
AuthorDate: Mon Dec 17 16:13:00 2018 +0100

    refactored
---
 .../myfaces/application/FacesServletMappingUtils.java      |  9 ++++-----
 .../main/java/org/apache/myfaces/config/MyfacesConfig.java |  3 ++-
 .../myfaces/webapp/{webxml => }/DelegatedFacesServlet.java |  2 +-
 .../apache/myfaces/webapp/MyFacesContainerInitializer.java |  1 -
 .../java/org/apache/myfaces/webapp/MyFacesServlet.java     |  1 -
 .../main/java/org/apache/myfaces/webapp/webxml/WebXml.java | 14 +-------------
 6 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/application/FacesServletMappingUtils.java
b/impl/src/main/java/org/apache/myfaces/application/FacesServletMappingUtils.java
index 7b8466e..b790dab 100644
--- a/impl/src/main/java/org/apache/myfaces/application/FacesServletMappingUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/application/FacesServletMappingUtils.java
@@ -22,15 +22,14 @@ package org.apache.myfaces.application;
 import java.util.Collection;
 import java.util.Map;
 
-import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import javax.faces.webapp.FacesServlet;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletRegistration;
+import org.apache.myfaces.config.MyfacesConfig;
 import org.apache.myfaces.util.ClassUtils;
 import org.apache.myfaces.util.ExternalContextUtils;
-import org.apache.myfaces.webapp.webxml.DelegatedFacesServlet;
-import org.apache.myfaces.webapp.webxml.WebXml;
+import org.apache.myfaces.webapp.DelegatedFacesServlet;
 
 public class FacesServletMappingUtils
 {
@@ -94,11 +93,11 @@ public class FacesServletMappingUtils
         Class servletClass = ClassUtils.simpleClassForName(servletClassName, false);
         if (servletClass != null)
         {
-            ExternalContext externalContext = facesContext.getExternalContext();
+            MyfacesConfig config = MyfacesConfig.getCurrentInstance(facesContext);
             
             return FacesServlet.class.isAssignableFrom(servletClass)
                     || DelegatedFacesServlet.class.isAssignableFrom(servletClass)
-                    || servletClass.getName().equals(WebXml.getWebXml(externalContext).getDelegateFacesServlet());
+                    || servletClass.getName().equals(config.getDelegateFacesServlet());
         }
         return false;
     }
diff --git a/impl/src/main/java/org/apache/myfaces/config/MyfacesConfig.java b/impl/src/main/java/org/apache/myfaces/config/MyfacesConfig.java
index d95f144..08f5885 100755
--- a/impl/src/main/java/org/apache/myfaces/config/MyfacesConfig.java
+++ b/impl/src/main/java/org/apache/myfaces/config/MyfacesConfig.java
@@ -852,7 +852,8 @@ public class MyfacesConfig
         cfg.configRefreshPeriod = getLong(extCtx, CONFIG_REFRESH_PERIOD,
                 CONFIG_REFRESH_PERIOD_DEFAULT);
 
-        cfg.delegateFacesServlet = extCtx.getInitParameter(DELEGATE_FACES_SERVLET);
+        cfg.delegateFacesServlet = getString(extCtx, DELEGATE_FACES_SERVLET,
+                null);
         
         String refreshTransientBuildOnPSS = getString(extCtx, REFRESH_TRANSIENT_BUILD_ON_PSS,

                 REFRESH_TRANSIENT_BUILD_ON_PSS_DEFAULT);
diff --git a/impl/src/main/java/org/apache/myfaces/webapp/webxml/DelegatedFacesServlet.java
b/impl/src/main/java/org/apache/myfaces/webapp/DelegatedFacesServlet.java
similarity index 95%
rename from impl/src/main/java/org/apache/myfaces/webapp/webxml/DelegatedFacesServlet.java
rename to impl/src/main/java/org/apache/myfaces/webapp/DelegatedFacesServlet.java
index 6a4059b..a280e82 100644
--- a/impl/src/main/java/org/apache/myfaces/webapp/webxml/DelegatedFacesServlet.java
+++ b/impl/src/main/java/org/apache/myfaces/webapp/DelegatedFacesServlet.java
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.myfaces.webapp.webxml;
+package org.apache.myfaces.webapp;
 
 public interface DelegatedFacesServlet
 {
diff --git a/impl/src/main/java/org/apache/myfaces/webapp/MyFacesContainerInitializer.java
b/impl/src/main/java/org/apache/myfaces/webapp/MyFacesContainerInitializer.java
index 64a798a..18947ec 100644
--- a/impl/src/main/java/org/apache/myfaces/webapp/MyFacesContainerInitializer.java
+++ b/impl/src/main/java/org/apache/myfaces/webapp/MyFacesContainerInitializer.java
@@ -54,7 +54,6 @@ import javax.servlet.annotation.HandlesTypes;
 import org.apache.myfaces.config.MyfacesConfig;
 
 import org.apache.myfaces.context.servlet.StartupServletExternalContextImpl;
-import org.apache.myfaces.webapp.webxml.DelegatedFacesServlet;
 import org.apache.myfaces.spi.FacesConfigResourceProvider;
 import org.apache.myfaces.spi.FacesConfigResourceProviderFactory;
 
diff --git a/impl/src/main/java/org/apache/myfaces/webapp/MyFacesServlet.java b/impl/src/main/java/org/apache/myfaces/webapp/MyFacesServlet.java
index 2222c15..4527fab 100755
--- a/impl/src/main/java/org/apache/myfaces/webapp/MyFacesServlet.java
+++ b/impl/src/main/java/org/apache/myfaces/webapp/MyFacesServlet.java
@@ -30,7 +30,6 @@ import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
-import org.apache.myfaces.webapp.webxml.DelegatedFacesServlet;
 
 /**
  * Derived FacesServlet that can be used for debugging purpose
diff --git a/impl/src/main/java/org/apache/myfaces/webapp/webxml/WebXml.java b/impl/src/main/java/org/apache/myfaces/webapp/webxml/WebXml.java
index 677e888..971e389 100755
--- a/impl/src/main/java/org/apache/myfaces/webapp/webxml/WebXml.java
+++ b/impl/src/main/java/org/apache/myfaces/webapp/webxml/WebXml.java
@@ -31,24 +31,13 @@ public class WebXml
     private static long refreshPeriod;
     private long parsingTime;
 
-    private String _delegateFacesServlet = null;
     private boolean errorPagePresent = false;
 
     protected void setParsingTime(long parsingTime)
     {
         this.parsingTime = parsingTime;
     }
-    
-    private void setDelegateFacesServlet(String delegateFacesServlet)
-    {
-        this._delegateFacesServlet = delegateFacesServlet;
-    }
-    
-    public String getDelegateFacesServlet()
-    {
-        return this._delegateFacesServlet;
-    }
-    
+
     /**
      * Sets if, the web.xml contains an error-page entry
      * @param errorPagePresent
@@ -105,7 +94,6 @@ public class WebXml
         MyfacesConfig mfconfig = MyfacesConfig.getCurrentInstance(context);
         long configRefreshPeriod = mfconfig.getConfigRefreshPeriod();
         webXml.setParsingTime(System.currentTimeMillis());
-        webXml.setDelegateFacesServlet(mfconfig.getDelegateFacesServlet());
         refreshPeriod = (configRefreshPeriod * 1000);
     }
 


Mime
View raw message