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 Sat, 22 Dec 2018 17:04:57 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 edfc42a  refactored
edfc42a is described below

commit edfc42a6756edffe93995a4cf299438f2d43d032
Author: Thomas Andraschko <tandraschko@apache.org>
AuthorDate: Sat Dec 22 18:05:06 2018 +0100

    refactored
---
 .../org/apache/myfaces/config/MyfacesConfig.java   | 56 +++++++++++++++++++++-
 1 file changed, 54 insertions(+), 2 deletions(-)

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 f30c491..7dc5a45 100755
--- a/impl/src/main/java/org/apache/myfaces/config/MyfacesConfig.java
+++ b/impl/src/main/java/org/apache/myfaces/config/MyfacesConfig.java
@@ -20,6 +20,7 @@ package org.apache.myfaces.config;
 
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import javax.faces.application.ProjectStage;
 import javax.faces.application.StateManager;
 import javax.faces.application.ViewHandler;
 import javax.faces.context.ExternalContext;
@@ -42,6 +43,7 @@ import org.apache.myfaces.util.StringUtils;
  * (or omitting the extended init parameters) all config properties will simply have
  * their default values.
  */
+//CHECKSTYLE:OFF
 public class MyfacesConfig
 {
     private static final String APPLICATION_MAP_PARAM_NAME = MyfacesConfig.class.getName();
@@ -723,7 +725,8 @@ public class MyfacesConfig
     @JSFWebConfigParam(since = "2.0", alias = "facelets.RESOURCE_RESOLVER")
     public final static String RESOURCE_RESOLVER = "javax.faces.FACELETS_RESOURCE_RESOLVER";
     
-    
+    // we need it, applicationImpl not ready probably
+    private ProjectStage projectStage = ProjectStage.Production;
     private boolean strictJsf2AllowSlashLibraryName;
     private long configRefreshPeriod = CONFIG_REFRESH_PERIOD_DEFAULT;
     private boolean renderViewStateId = RENDER_VIEWSTATE_ID_DEFAULT;
@@ -792,6 +795,9 @@ public class MyfacesConfig
     private int faceletsBufferSize = 1024;
     private boolean markInitialStateWhenApplyBuildView = MARK_INITIAL_STATE_WHEN_APPLY_BUILD_VIEW_DEFAULT;
     private String resourceResolver;
+    private String[] viewSuffix = new String[] { ViewHandler.DEFAULT_SUFFIX };
+    private String[] faceletsViewMappings = new String[] {};
+    private String faceletsViewSuffix = ViewHandler.DEFAULT_FACELETS_SUFFIX;
     
     
     private static final boolean MYFACES_IMPL_AVAILABLE;
@@ -856,6 +862,19 @@ public class MyfacesConfig
     {
         MyfacesConfig cfg = new MyfacesConfig();
 
+        try
+        {
+            cfg.projectStage = ProjectStage.valueOf(getString(extCtx, ProjectStage.PROJECT_STAGE_PARAM_NAME,
null));
+        }
+        catch (IllegalArgumentException e)
+        {
+            // ignore, it's logged in ApplicationImpl
+        }
+        if (cfg.projectStage == null)
+        {
+            cfg.projectStage = ProjectStage.Production;
+        }
+
         cfg.renderClearJavascriptOnButton = getBoolean(extCtx, RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON,
                 RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT);
 
@@ -1097,7 +1116,11 @@ public class MyfacesConfig
         
         cfg.checkedViewIdCacheEnabled = getBoolean(extCtx, CHECKED_VIEWID_CACHE_ENABLED,
                 CHECKED_VIEWID_CACHE_ENABLED_DEFAULT);
-        
+        if (cfg.projectStage == ProjectStage.Development)
+        {
+            cfg.checkedViewIdCacheEnabled = false;
+        }
+
         cfg.checkedViewIdCacheSize = getInt(extCtx, CHECKED_VIEWID_CACHE_SIZE,
                 CHECKED_VIEWID_CACHE_SIZE_DEFAULT);
         
@@ -1138,6 +1161,17 @@ public class MyfacesConfig
         cfg.resourceResolver = getString(extCtx, RESOURCE_RESOLVER,
                 null);
         
+        cfg.viewSuffix = StringUtils.splitShortString(
+                getString(extCtx, ViewHandler.DEFAULT_SUFFIX_PARAM_NAME, ViewHandler.DEFAULT_SUFFIX),
+                ' ');
+        
+        cfg.faceletsViewMappings = StringUtils.splitShortString(
+                getString(extCtx, ViewHandler.FACELETS_VIEW_MAPPINGS_PARAM_NAME, null),
+                ';');
+        
+        cfg.faceletsViewSuffix = getString(extCtx, ViewHandler.FACELETS_SUFFIX_PARAM_NAME,
+                ViewHandler.DEFAULT_FACELETS_SUFFIX);
+        
         return cfg;
     }
 
@@ -1553,6 +1587,24 @@ public class MyfacesConfig
         return resourceResolver;
     }
 
+    public String[] getViewSuffix()
+    {
+        return viewSuffix;
+    }
+
+    public String[] getFaceletsViewMappings()
+    {
+        return faceletsViewMappings;
+    }
+
+    public String getFaceletsViewSuffix()
+    {
+        return faceletsViewSuffix;
+    }
+
+
+ 
+
     
 }
 


Mime
View raw message