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 2012/09/04 22:10:52 UTC

svn commit: r1380846 - in /myfaces/shared/trunk/core: ./ src/main/java/org/apache/myfaces/shared/config/ src/main/java/org/apache/myfaces/shared/renderkit/html/ src/main/java/org/apache/myfaces/shared/util/ src/main/resources/META-INF/

Author: lu4242
Date: Tue Sep  4 20:10:51 2012
New Revision: 1380846

URL: http://svn.apache.org/viewvc?rev=1380846&view=rev
Log:
synch shared with version 2.1.9

Modified:
    myfaces/shared/trunk/core/pom.xml
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/MessageUtils.java
    myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml

Modified: myfaces/shared/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/pom.xml?rev=1380846&r1=1380845&r2=1380846&view=diff
==============================================================================
--- myfaces/shared/trunk/core/pom.xml (original)
+++ myfaces/shared/trunk/core/pom.xml Tue Sep  4 20:10:51 2012
@@ -143,7 +143,7 @@
     <profile>
       <id>synch-myfaces-impl-shared</id>
       <properties>
-        <myfaces.impl.shared.version>2.1.8-SNAPSHOT</myfaces.impl.shared.version>
+        <myfaces.impl.shared.version>2.1.9-SNAPSHOT</myfaces.impl.shared.version>
       </properties>
       <activation>
         <property>

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java?rev=1380846&r1=1380845&r2=1380846&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java Tue Sep  4 20:10:51 2012
@@ -390,6 +390,34 @@ public class MyfacesConfig
     public final static String INIT_PARAM_SUPPORT_JSP_AND_FACES_EL = "org.apache.myfaces.SUPPORT_JSP_AND_FACES_EL";
     public final static boolean INIT_PARAM_SUPPORT_JSP_AND_FACES_EL_DEFAULT = true;
     
+    /**
+     * When the application runs inside Google Application Engine container (GAE),
+     * indicate which jar files should be scanned for files (faces-config, facelets taglib
+     * or annotations). It accept simple wildcard patterns like myfavoritejsflib-*.jar or 
+     * myfavoritejsflib-1.1.?.jar. By default, all the classpath is scanned for files 
+     * annotations (so it adds an small delay on startup).
+     */
+    @JSFWebConfigParam(since = "2.1.8, 2.0.14", expectedValues="none, myfavoritejsflib-*.jar",
+            tags="performance, GAE")
+    public static final String INIT_PARAM_GAE_JSF_JAR_FILES = "org.apache.myfaces.GAE_JSF_JAR_FILES";
+    public final static String INIT_PARAM_GAE_JSF_JAR_FILES_DEFAULT = null;
+
+    /**
+     * When the application runs inside Google Application Engine container (GAE),
+     * indicate which jar files should be scanned for annotations. This param overrides
+     * org.apache.myfaces.GAE_JSF_JAR_FILES behavior that tries to find faces-config.xml or
+     * files ending with .faces-config.xml in /META-INF folder and if that so, try to
+     * find JSF annotations in the whole jar file. It accept simple wildcard patterns 
+     * like myfavoritejsflib-*.jar or myfavoritejsflib-1.1.?.jar.
+     * By default, all the classpath is scanned for annotations (so it adds an small
+     * delay on startup).
+     */
+    @JSFWebConfigParam(since = "2.1.8, 2.0.14", expectedValues="none, myfavoritejsflib-*.jar",
+            tags="performance, GAE")
+    public static final String INIT_PARAM_GAE_JSF_ANNOTATIONS_JAR_FILES = 
+            "org.apache.myfaces.GAE_JSF_ANNOTATIONS_JAR_FILES";
+    public final static String INIT_PARAM_GAE_JSF_ANNOTATIONS_JAR_FILES_DEFAULT = null;
+
     private boolean _prettyHtml;
     private boolean _detectJavascript;
     private boolean _allowJavascript;
@@ -419,6 +447,8 @@ public class MyfacesConfig
     private boolean _viewUniqueIdsCacheEnabled;
     private int _componentUniqueIdsCacheSize;
     private boolean _supportJSPAndFacesEL;
+    private String _gaeJsfJarFiles;
+    private String _gaeJsfAnnotationsJarFiles;
 
     private static final boolean TOMAHAWK_AVAILABLE;
     private static final boolean MYFACES_IMPL_AVAILABLE;
@@ -517,6 +547,8 @@ public class MyfacesConfig
         setViewUniqueIdsCacheEnabled(INIT_PARAM_VIEW_UNIQUE_IDS_CACHE_ENABLED_DEFAULT);
         setComponentUniqueIdsCacheSize(INIT_PARAM_COMPONENT_UNIQUE_IDS_CACHE_SIZE_DEFAULT);
         setSupportJSPAndFacesEL(INIT_PARAM_SUPPORT_JSP_AND_FACES_EL_DEFAULT);
+        setGaeJsfJarFiles(INIT_PARAM_GAE_JSF_JAR_FILES_DEFAULT);
+        setGaeJsfAnnotationsJarFiles(INIT_PARAM_GAE_JSF_ANNOTATIONS_JAR_FILES_DEFAULT);
     }
 
     private static MyfacesConfig createAndInitializeMyFacesConfig(ExternalContext extCtx)
@@ -619,6 +651,11 @@ public class MyfacesConfig
         myfacesConfig.setSupportJSPAndFacesEL(WebConfigParamUtils.getBooleanInitParameter(extCtx, 
                 INIT_PARAM_SUPPORT_JSP_AND_FACES_EL, INIT_PARAM_SUPPORT_JSP_AND_FACES_EL_DEFAULT));
         
+        myfacesConfig.setGaeJsfJarFiles(WebConfigParamUtils.getStringInitParameter(extCtx, 
+                INIT_PARAM_GAE_JSF_JAR_FILES, INIT_PARAM_GAE_JSF_JAR_FILES_DEFAULT));
+        myfacesConfig.setGaeJsfAnnotationsJarFiles(WebConfigParamUtils.getStringInitParameter(extCtx, 
+                INIT_PARAM_GAE_JSF_ANNOTATIONS_JAR_FILES, INIT_PARAM_GAE_JSF_ANNOTATIONS_JAR_FILES_DEFAULT));
+        
         if (TOMAHAWK_AVAILABLE)
         {
             myfacesConfig.setDetectJavascript(getBooleanInitParameter(extCtx, INIT_PARAM_DETECT_JAVASCRIPT,
@@ -1116,4 +1153,25 @@ public class MyfacesConfig
     {
         this._componentUniqueIdsCacheSize = componentUniqueIdsCacheSize;
     }
+
+    public String getGaeJsfJarFiles()
+    {
+        return _gaeJsfJarFiles;
+    }
+
+    public void setGaeJsfJarFiles(String gaeJsfJarFiles)
+    {
+        this._gaeJsfJarFiles = gaeJsfJarFiles;
+    }
+
+    public String getGaeJsfAnnotationsJarFiles()
+    {
+        return _gaeJsfAnnotationsJarFiles;
+    }
+
+    public void setGaeJsfAnnotationsJarFiles(String gaeJsfAnnotationsJarFiles)
+    {
+        this._gaeJsfAnnotationsJarFiles = gaeJsfAnnotationsJarFiles;
+    }
+
 }

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java?rev=1380846&r1=1380845&r2=1380846&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java Tue Sep  4 20:10:51 2012
@@ -314,9 +314,30 @@ public abstract class HtmlLinkRendererBa
                     {
                         HtmlRendererUtils.writeIdAndName(writer, component, facesContext);
                     }
-                    else
+                    else 
                     {
-                        HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);
+                        // If onclick is not null, both onclick and server side script are rendered 
+                        // using jsf.util.chain(...) js function. We need to check that case and force
+                        // id/name rendering. It is possible to do something else in that case and 
+                        // do not render the script using jsf.util.chain, but for now it is ok.
+                        String commandOnclick;
+                        if (component instanceof HtmlCommandLink)
+                        {
+                            commandOnclick = ((HtmlCommandLink)component).getOnclick();
+                        }
+                        else
+                        {
+                            commandOnclick = (String)component.getAttributes().get(HTML.ONCLICK_ATTR);
+                        }
+                        
+                        if (commandOnclick != null)
+                        {
+                            HtmlRendererUtils.writeIdAndName(writer, component, facesContext);
+                        }
+                        else
+                        {
+                            HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);
+                        }
                     }
                     long commonPropertiesMarked = 0L;
                     if (isCommonPropertiesOptimizationEnabled(facesContext))

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/MessageUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/MessageUtils.java?rev=1380846&r1=1380845&r2=1380846&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/MessageUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/MessageUtils.java Tue Sep  4 20:10:51 2012
@@ -645,12 +645,33 @@ public final class MessageUtils
     public static Object getLabel(FacesContext facesContext, UIComponent component)
     {
         Object label = component.getAttributes().get("label");
+        ValueExpression expression = null;
+        if (label != null && 
+            label instanceof String && ((String)label).length() == 0 )
+        {
+            // Note component.getAttributes().get("label") internally try to 
+            // evaluate the EL expression for the label, but in some cases, 
+            // when PSS is disabled and f:loadBundle is used, when the view is 
+            // restored the bundle is not set to the EL expression returns an 
+            // empty String. It is not possible to check if there is a 
+            // hardcoded label, but we can check if there is
+            // an EL expression set, so the best in this case is use that, and if
+            // there is an EL expression set, use it, otherwise use the hardcoded
+            // value. See MYFACES-3591 for details.
+            expression = component.getValueExpression("label");
+            if (expression != null)
+            {
+                // Set the label to null and use the EL expression instead.
+                label = null;
+            }
+        }
+            
         if(label != null)
         {
             return label;
         }
         
-        ValueExpression expression = component.getValueExpression("label");
+        expression = (expression == null) ? component.getValueExpression("label") : expression;
         if(expression != null)
         {
             return expression;

Modified: myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml?rev=1380846&r1=1380845&r2=1380846&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml (original)
+++ myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml Tue Sep  4 20:10:51 2012
@@ -8245,6 +8245,40 @@ ELResolver) and all related logic for JS
       <tags>performance</tags>
     </webConfigParam>
     <webConfigParam>
+      <name>org.apache.myfaces.GAE_JSF_JAR_FILES</name>
+      <fieldName>INIT_PARAM_GAE_JSF_JAR_FILES</fieldName>
+      <desc>When the application runs inside Google Application Engine container (GAE),
+indicate which jar files should be scanned for files (faces-config, facelets taglib
+or annotations)</desc>
+      <longDesc>When the application runs inside Google Application Engine container (GAE),
+indicate which jar files should be scanned for files (faces-config, facelets taglib
+or annotations). It accept simple wildcard patterns like myfavoritejsflib-*.jar or 
+myfavoritejsflib-1.1.?.jar. By default, all the classpath is scanned for files 
+annotations (so it adds an small delay on startup).</longDesc>
+      <expectedValues>none, myfavoritejsflib-*.jar</expectedValues>
+      <sourceClassName>org.apache.myfaces.shared.config.MyfacesConfig</sourceClassName>
+      <since>2.1.8, 2.0.14</since>
+      <tags>performance, GAE</tags>
+    </webConfigParam>
+    <webConfigParam>
+      <name>org.apache.myfaces.GAE_JSF_ANNOTATIONS_JAR_FILES</name>
+      <fieldName>INIT_PARAM_GAE_JSF_ANNOTATIONS_JAR_FILES</fieldName>
+      <desc>When the application runs inside Google Application Engine container (GAE),
+indicate which jar files should be scanned for annotations</desc>
+      <longDesc>When the application runs inside Google Application Engine container (GAE),
+indicate which jar files should be scanned for annotations. This param overrides
+org.apache.myfaces.GAE_JSF_JAR_FILES behavior that tries to find faces-config.xml or
+files ending with .faces-config.xml in /META-INF folder and if that so, try to
+find JSF annotations in the whole jar file. It accept simple wildcard patterns 
+like myfavoritejsflib-*.jar or myfavoritejsflib-1.1.?.jar.
+By default, all the classpath is scanned for annotations (so it adds an small
+delay on startup).</longDesc>
+      <expectedValues>none, myfavoritejsflib-*.jar</expectedValues>
+      <sourceClassName>org.apache.myfaces.shared.config.MyfacesConfig</sourceClassName>
+      <since>2.1.8, 2.0.14</since>
+      <tags>performance, GAE</tags>
+    </webConfigParam>
+    <webConfigParam>
       <name>org.apache.myfaces.FLASH_SCOPE_DISABLED</name>
       <fieldName>FLASH_SCOPE_DISABLED_PARAM</fieldName>
       <desc>Defines whether flash scope is disabled, preventing add the Flash cookie to the response</desc>