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 2013/10/25 23:24:10 UTC

svn commit: r1535874 [1/9] - in /myfaces/shared/trunk/core/src: main/java/org/apache/myfaces/shared/application/ main/java/org/apache/myfaces/shared/config/ main/java/org/apache/myfaces/shared/context/flash/ main/java/org/apache/myfaces/shared/renderki...

Author: lu4242
Date: Fri Oct 25 21:24:09 2013
New Revision: 1535874

URL: http://svn.apache.org/r1535874
Log:
synch shared

Added:
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HttpPartWrapper.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/OutcomeTargetUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ContractResource.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ContractResourceLoader.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ResourceCachedInfo.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ResourceELUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/ViewProtectionUtils.java
Removed:
    myfaces/shared/trunk/core/src/test/java/org/apache/myfaces/shared/context/flash/FlashImplTest.java
Modified:
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java
    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/context/flash/FlashImpl.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/JSFAttr.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyConstants.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlInputFileRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.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/renderkit/html/HtmlMessageRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/JavascriptContext.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/ResourceUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/AliasResourceMetaImpl.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/BaseResourceHandlerSupport.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ClassLoaderResourceLoader.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ExternalContextResourceLoader.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ResourceHandlerCache.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ResourceHandlerSupport.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ResourceImpl.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ResourceLoader.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ResourceLoaderWrapper.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ResourceMeta.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ResourceMetaImpl.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ResourceValidationUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ValueExpressionFilterInputStream.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentTagUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/core/SelectItemTagBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/AttachedDeltaWrapper.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/ClassUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/ComponentUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/ConcurrentLRUCache.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/DebugUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/PriorityQueue.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/RendererUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/TagUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/io/DynamicPushbackInputStream.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/renderkit/ClientBehaviorEvents.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/renderkit/HTML.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/renderkit/JsfProperties.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/view/ViewDeclarationLanguageBase.java
    myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java?rev=1535874&r1=1535873&r2=1535874&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java Fri Oct 25 21:24:09 2013
@@ -27,6 +27,7 @@ import javax.faces.application.ProjectSt
 import javax.faces.application.ViewHandler;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
+import javax.faces.render.ResponseStateManager;
 import javax.faces.view.ViewDeclarationLanguage;
 
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
@@ -34,6 +35,7 @@ import org.apache.myfaces.shared.renderk
 import org.apache.myfaces.shared.util.ConcurrentLRUCache;
 import org.apache.myfaces.shared.util.ExternalContextUtils;
 import org.apache.myfaces.shared.util.StringUtils;
+import org.apache.myfaces.shared.util.ViewProtectionUtils;
 import org.apache.myfaces.shared.util.WebConfigParamUtils;
 
 /**
@@ -198,7 +200,12 @@ public class DefaultViewHandlerSupport i
         String contextPath = externalContext.getRequestContextPath();
         //StringBuilder builder = new StringBuilder(contextPath);
         StringBuilder builder = SharedStringBuilder.get(context, VIEW_HANDLER_SUPPORT_SB);
-        builder.append(contextPath);
+        // If the context path is root, it is not necessary to append it, otherwise
+        // and extra '/' will be set.
+        if (contextPath != null && !(contextPath.length() == 1 && contextPath.charAt(0) == '/') )
+        {
+            builder.append(contextPath);
+        }
         if (mapping != null)
         {
             if (mapping.isExtensionMapping())
@@ -255,6 +262,25 @@ public class DefaultViewHandlerSupport i
         {
             builder.append(viewId);
         }
+        
+        //JSF 2.2 check view protection.
+        if (ViewProtectionUtils.isViewProtected(context, viewId))
+        {
+            int index = builder.indexOf("?");
+            if (index >= 0)
+            {
+                builder.append("&");
+            }
+            else
+            {
+                builder.append("?");
+            }
+            builder.append(ResponseStateManager.NON_POSTBACK_VIEW_TOKEN_PARAM);
+            builder.append("=");
+            ResponseStateManager rsm = context.getRenderKit().getResponseStateManager();
+            builder.append(rsm.getCryptographicallyStrongTokenFromSession(context));
+        }
+        
         String calculatedActionURL = builder.toString();
         if (log.isLoggable(Level.FINEST))
         {

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java?rev=1535874&r1=1535873&r2=1535874&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java Fri Oct 25 21:24:09 2013
@@ -1,109 +1,109 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.shared.application;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-
-/**
- * 
- * @author Leonardo Uribe
- *
- */
-public class NavigationUtils
-{
-    /**
-     * Evaluate all EL expressions found as parameters and return a map that can be used for 
-     * redirect or render bookmark links
-     * 
-     * @param parameters parameter map retrieved from NavigationCase.getParameters()
-     * @return
-     */
-    public static Map<String, List<String> > getEvaluatedNavigationParameters(
-            FacesContext facesContext, 
-            Map<String, List<String> > parameters)
-    {
-        Map<String,List<String>> evaluatedParameters = null;
-        if (parameters != null && parameters.size() > 0)
-        {
-            evaluatedParameters = new HashMap<String, List<String>>();
-            for (Map.Entry<String, List<String>> pair : parameters.entrySet())
-            {
-                boolean containsEL = false;
-                for (String value : pair.getValue())
-                {
-                    if (_isExpression(value))
-                    {
-                        containsEL = true;
-                        break;
-                    }
-                }
-                if (containsEL)
-                {
-                    evaluatedParameters.put(pair.getKey(), 
-                            _evaluateValueExpressions(facesContext, pair.getValue()));
-                }
-                else
-                {
-                    evaluatedParameters.put(pair.getKey(), pair.getValue());
-                }
-            }
-        }
-        else
-        {
-            evaluatedParameters = parameters;
-        }
-        return evaluatedParameters;
-    }
-    
-    /**
-     * Checks the Strings in the List for EL expressions and evaluates them.
-     * Note that the returned List will be a copy of the given List, because
-     * otherwise it will have unwanted side-effects.
-     * @param values
-     * @return
-     */
-    private static List<String> _evaluateValueExpressions(FacesContext context, List<String> values)
-    {
-        // note that we have to create a new List here, because if we
-        // change any value on the given List, it will be changed in the
-        // NavigationCase too and the EL expression won't be evaluated again
-        List<String> target = new ArrayList<String>(values.size());
-        for (String value : values)
-        {
-            if (_isExpression(value))
-            {
-                // evaluate the ValueExpression
-                value = context.getApplication().evaluateExpressionGet(context, value, String.class);
-            }
-            target.add(value);
-        }
-        return target;
-    }
-    
-    private static boolean _isExpression(String text)
-    {
-        return text.indexOf("#{") != -1;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.application;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * 
+ * @author Leonardo Uribe
+ *
+ */
+public class NavigationUtils
+{
+    /**
+     * Evaluate all EL expressions found as parameters and return a map that can be used for 
+     * redirect or render bookmark links
+     * 
+     * @param parameters parameter map retrieved from NavigationCase.getParameters()
+     * @return
+     */
+    public static Map<String, List<String> > getEvaluatedNavigationParameters(
+            FacesContext facesContext, 
+            Map<String, List<String> > parameters)
+    {
+        Map<String,List<String>> evaluatedParameters = null;
+        if (parameters != null && parameters.size() > 0)
+        {
+            evaluatedParameters = new HashMap<String, List<String>>();
+            for (Map.Entry<String, List<String>> pair : parameters.entrySet())
+            {
+                boolean containsEL = false;
+                for (String value : pair.getValue())
+                {
+                    if (_isExpression(value))
+                    {
+                        containsEL = true;
+                        break;
+                    }
+                }
+                if (containsEL)
+                {
+                    evaluatedParameters.put(pair.getKey(), 
+                            _evaluateValueExpressions(facesContext, pair.getValue()));
+                }
+                else
+                {
+                    evaluatedParameters.put(pair.getKey(), pair.getValue());
+                }
+            }
+        }
+        else
+        {
+            evaluatedParameters = parameters;
+        }
+        return evaluatedParameters;
+    }
+    
+    /**
+     * Checks the Strings in the List for EL expressions and evaluates them.
+     * Note that the returned List will be a copy of the given List, because
+     * otherwise it will have unwanted side-effects.
+     * @param values
+     * @return
+     */
+    private static List<String> _evaluateValueExpressions(FacesContext context, List<String> values)
+    {
+        // note that we have to create a new List here, because if we
+        // change any value on the given List, it will be changed in the
+        // NavigationCase too and the EL expression won't be evaluated again
+        List<String> target = new ArrayList<String>(values.size());
+        for (String value : values)
+        {
+            if (_isExpression(value))
+            {
+                // evaluate the ValueExpression
+                value = context.getApplication().evaluateExpressionGet(context, value, String.class);
+            }
+            target.add(value);
+        }
+        return target;
+    }
+    
+    private static boolean _isExpression(String text)
+    {
+        return text.indexOf("#{") != -1;
+    }
+
+}

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=1535874&r1=1535873&r2=1535874&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 Fri Oct 25 21:24:09 2013
@@ -291,11 +291,11 @@ public class MyfacesConfig
     /**
      * Wrap content inside script with xml comment to prevent old browsers to display it. By default it is true. 
      */
-    @JSFWebConfigParam(since="2.0.1", expectedValues="true, false, on, off, yes, no", defaultValue="true",
+    @JSFWebConfigParam(since="2.0.1", expectedValues="true, false, on, off, yes, no", defaultValue="false",
             ignoreUpperLowerCase=true, group="render")
     public final static String INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG = 
         "org.apache.myfaces.WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG";
-    public final static boolean INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT = true;
+    public final static boolean INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT = false;
     
     /**
      * If set true, render the form submit script inline, as in myfaces core 1.2 and earlier versions 
@@ -417,6 +417,40 @@ public class MyfacesConfig
     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;
+    
+    /**
+     * If this param is set to true, a check will be done in Restore View Phase to check
+     * if the viewId exists or not and if it does not exists, a 404 response will be thrown.
+     * 
+     * This is applicable in cases where all the views in the application are generated by a 
+     * ViewDeclarationLanguage implementation.
+     */
+    @JSFWebConfigParam(since = "2.1.13", defaultValue="false", expectedValues="true,false", 
+            group="viewhandler")
+    public static final String INIT_PARAM_STRICT_JSF_2_VIEW_NOT_FOUND = 
+            "org.apache.myfaces.STRICT_JSF_2_VIEW_NOT_FOUND";
+    public final static boolean INIT_PARAM_STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT = false;
+
+    @JSFWebConfigParam(defaultValue = "false", since = "2.2.0", expectedValues="true, false", group="render",
+            tags="performance",
+            desc="Enable or disable an early flush which allows to send e.g. the HTML-Head to the client " +
+                    "while the rest gets rendered. It's a well known technique to reduce the time for loading a page.")
+    private static final String INIT_PARAM_EARLY_FLUSH_ENABLED =
+        "org.apache.myfaces.EARLY_FLUSH_ENABLED";
+    private static final boolean INIT_PARAM_EARLY_FLUSH_ENABLED_DEFAULT = false;
+
+    @JSFWebConfigParam(defaultValue = "false", since = "2.2.0", expectedValues="true, false", group="cdi",
+            tags="injection",
+            desc="Enable or disable CDI support for converters.")
+    private static final String INIT_PARAM_CDI_MANAGED_CONVERTERS_ENABLED =
+        "org.apache.myfaces.CDI_MANAGED_CONVERTERS_ENABLED";
+    private static final boolean INIT_PARAM_CDI_MANAGED_CONVERTERS_DEFAULT = false;
+    @JSFWebConfigParam(defaultValue = "false", since = "2.2.0", expectedValues="true, false", group="cdi",
+            tags="injection",
+            desc="Enable or disable CDI support for validators.")
+    private static final String INIT_PARAM_CDI_MANAGED_VALIDATORS_ENABLED =
+        "org.apache.myfaces.CDI_MANAGED_VALIDATORS_ENABLED";
+    private static final boolean INIT_PARAM_CDI_MANAGED_VALIDATORS_DEFAULT = false;
 
     private boolean _prettyHtml;
     private boolean _detectJavascript;
@@ -449,6 +483,10 @@ public class MyfacesConfig
     private boolean _supportJSPAndFacesEL;
     private String _gaeJsfJarFiles;
     private String _gaeJsfAnnotationsJarFiles;
+    private boolean _strictJsf2ViewNotFound;
+    private boolean _earlyFlushEnabled;
+    private boolean _cdiManagedConvertersEnabled;
+    private boolean _cdiManagedValidatorsEnabled;
 
     private static final boolean TOMAHAWK_AVAILABLE;
     private static final boolean MYFACES_IMPL_AVAILABLE;
@@ -549,6 +587,10 @@ public class MyfacesConfig
         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);
+        setStrictJsf2ViewNotFound(INIT_PARAM_STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT);
+        setEarlyFlushEnabled(INIT_PARAM_EARLY_FLUSH_ENABLED_DEFAULT);
+        setCdiManagedConvertersEnabled(INIT_PARAM_CDI_MANAGED_CONVERTERS_DEFAULT);
+        setCdiManagedValidatorsEnabled(INIT_PARAM_CDI_MANAGED_VALIDATORS_DEFAULT);
     }
 
     private static MyfacesConfig createAndInitializeMyFacesConfig(ExternalContext extCtx)
@@ -655,7 +697,18 @@ public class MyfacesConfig
                 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));
+
+        myfacesConfig.setStrictJsf2ViewNotFound(WebConfigParamUtils.getBooleanInitParameter(extCtx, 
+                INIT_PARAM_STRICT_JSF_2_VIEW_NOT_FOUND, INIT_PARAM_STRICT_JSF_2_VIEW_NOT_FOUND_DEFAULT));
         
+        myfacesConfig.setEarlyFlushEnabled(WebConfigParamUtils.getBooleanInitParameter(extCtx,
+                INIT_PARAM_EARLY_FLUSH_ENABLED, INIT_PARAM_EARLY_FLUSH_ENABLED_DEFAULT));
+
+        myfacesConfig.setCdiManagedConvertersEnabled(WebConfigParamUtils.getBooleanInitParameter(extCtx,
+                INIT_PARAM_CDI_MANAGED_CONVERTERS_ENABLED, INIT_PARAM_CDI_MANAGED_CONVERTERS_DEFAULT));
+        myfacesConfig.setCdiManagedValidatorsEnabled(WebConfigParamUtils.getBooleanInitParameter(extCtx,
+                INIT_PARAM_CDI_MANAGED_VALIDATORS_ENABLED, INIT_PARAM_CDI_MANAGED_VALIDATORS_DEFAULT));
+
         if (TOMAHAWK_AVAILABLE)
         {
             myfacesConfig.setDetectJavascript(getBooleanInitParameter(extCtx, INIT_PARAM_DETECT_JAVASCRIPT,
@@ -1174,4 +1227,43 @@ public class MyfacesConfig
         this._gaeJsfAnnotationsJarFiles = gaeJsfAnnotationsJarFiles;
     }
 
+    public boolean isStrictJsf2ViewNotFound()
+    {
+        return _strictJsf2ViewNotFound;
+    }
+
+    public void setStrictJsf2ViewNotFound(boolean strictJsf2ViewNotFound)
+    {
+        this._strictJsf2ViewNotFound = strictJsf2ViewNotFound;
+    }
+
+    public boolean isEarlyFlushEnabled()
+    {
+        return _earlyFlushEnabled;
+    }
+
+    public void setEarlyFlushEnabled(boolean earlyFlushEnabled)
+    {
+        this._earlyFlushEnabled = earlyFlushEnabled;
+    }
+
+    public boolean isCdiManagedConvertersEnabled()
+    {
+        return _cdiManagedConvertersEnabled;
+    }
+
+    public void setCdiManagedConvertersEnabled(boolean cdiManagedConvertersEnabled)
+    {
+        this._cdiManagedConvertersEnabled = cdiManagedConvertersEnabled;
+    }
+
+    public boolean isCdiManagedValidatorsEnabled()
+    {
+        return _cdiManagedValidatorsEnabled;
+    }
+
+    public void setCdiManagedValidatorsEnabled(boolean cdiManagedValidatorsEnabled)
+    {
+        this._cdiManagedValidatorsEnabled = cdiManagedValidatorsEnabled;
+    }
 }

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java?rev=1535874&r1=1535873&r2=1535874&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java Fri Oct 25 21:24:09 2013
@@ -561,7 +561,10 @@ public class FlashImpl extends Flash
         final PhaseId currentPhaseId = facesContext.getCurrentPhaseId();
         
         boolean lastPhaseNormalRequest = PhaseId.RENDER_RESPONSE.equals(currentPhaseId);
-        boolean lastPhaseIfRedirect = PhaseId.INVOKE_APPLICATION.equals(currentPhaseId) 
+        // According to the spec, if there is a redirect, responseComplete() 
+        // has been called, and Flash.setRedirect() has been called too,
+        // so we just need to check both are present.
+        boolean lastPhaseIfRedirect = facesContext.getResponseComplete()
                 && _isRedirectTrueOnThisRequest(facesContext);
         
         return lastPhaseNormalRequest || lastPhaseIfRedirect;

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java?rev=1535874&r1=1535873&r2=1535874&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java Fri Oct 25 21:24:09 2013
@@ -1,136 +1,136 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.shared.renderkit;
-
-import javax.faces.context.FacesContext;
-
-import org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils;
-import org.apache.myfaces.shared.util.StringUtils;
-
-/**
- * 
- * @author Leonardo Uribe
- *
- */
-public class ContentTypeUtils
-{
-    public static final String HTML_CONTENT_TYPE = "text/html";
-    public static final String TEXT_ANY_CONTENT_TYPE = "text/*";
-    public static final String ANY_CONTENT_TYPE = "*/*";
-
-    public static final String[] HTML_ALLOWED_CONTENT_TYPES = {HTML_CONTENT_TYPE, 
-        ANY_CONTENT_TYPE, TEXT_ANY_CONTENT_TYPE};
-    
-    public static final String XHTML_CONTENT_TYPE = "application/xhtml+xml";
-    public static final String APPLICATION_XML_CONTENT_TYPE = "application/xml";
-    public static final String TEXT_XML_CONTENT_TYPE = "text/xml";
-    
-    public static final String[] XHTML_ALLOWED_CONTENT_TYPES = {XHTML_CONTENT_TYPE, 
-        APPLICATION_XML_CONTENT_TYPE, TEXT_XML_CONTENT_TYPE};
-    
-    public static final String[] AJAX_XHTML_ALLOWED_CONTENT_TYPES = {XHTML_CONTENT_TYPE};
-
-
-    /**
-     * Indicate if the passes content type match one of the options passed. 
-     */
-    public static boolean containsContentType(String contentType, String[] allowedContentTypes)
-    {
-        if (allowedContentTypes == null)
-        {
-            return false;
-        }
-        for (int i = 0; i < allowedContentTypes.length; i++)
-        {
-            if (allowedContentTypes[i].indexOf(contentType) != -1)
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public static String chooseWriterContentType(String contentTypeListString, 
-            String[] htmlContentTypes, String[] xhtmlContentTypes)
-    {
-        String[] contentTypeList = splitContentTypeListString(contentTypeListString);
-        String[] supportedContentTypeArray = HtmlRendererUtils.getSupportedContentTypes();
-        String selectedContentType = null;
-        for (int i = 0; i < supportedContentTypeArray.length; i++)
-        {
-            String supportedContentType = supportedContentTypeArray[i].trim();
-
-            for (int j = 0; j < contentTypeList.length; j++)
-            {
-                String contentType = (String) contentTypeList[j];
-
-                if (contentType.indexOf(supportedContentType) != -1)
-                {
-                    if (containsContentType(contentType, htmlContentTypes))
-                    {
-                        selectedContentType = HTML_CONTENT_TYPE;
-                    }
-                    else if (containsContentType(contentType, xhtmlContentTypes))
-                    {
-                        selectedContentType = XHTML_CONTENT_TYPE;
-                    }
-                    break;
-                }
-            }
-            if (selectedContentType != null)
-            {
-                break;
-            }
-        }
-        return selectedContentType;
-    }
-    
-    public static String[] splitContentTypeListString(String contentTypeListString)
-    {
-        String[] splittedArray = StringUtils.splitShortString(contentTypeListString, ',');
-        for (int i = 0; i < splittedArray.length; i++)
-        {
-            int semicolonIndex = splittedArray[i].indexOf(";");
-            if (semicolonIndex != -1)
-            {
-                splittedArray[i] = splittedArray[i].substring(0,semicolonIndex);
-            }
-        }
-        return splittedArray;
-    }
-    
-    public static String getContentTypeFromAcceptHeader(FacesContext context)
-    {
-        String contentTypeListString = (String) context.getExternalContext()
-            .getRequestHeaderMap().get("Accept");
-        // There is a windows mobile IE client (6.12) sending
-        // "application/vnd.wap.mms-message;*/*"
-        // Note that the Accept header should be written as 
-        // "application/vnd.wap.mms-message,*/*" ,
-        // so this is bug of the client. Anyway, this is a workaround ...
-        if (contentTypeListString != null
-                && contentTypeListString
-                        .startsWith("application/vnd.wap.mms-message;*/*"))
-        {
-            contentTypeListString = "*/*";
-        }
-        return contentTypeListString;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.renderkit;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils;
+import org.apache.myfaces.shared.util.StringUtils;
+
+/**
+ * 
+ * @author Leonardo Uribe
+ *
+ */
+public class ContentTypeUtils
+{
+    public static final String HTML_CONTENT_TYPE = "text/html";
+    public static final String TEXT_ANY_CONTENT_TYPE = "text/*";
+    public static final String ANY_CONTENT_TYPE = "*/*";
+
+    public static final String[] HTML_ALLOWED_CONTENT_TYPES = {HTML_CONTENT_TYPE, 
+        ANY_CONTENT_TYPE, TEXT_ANY_CONTENT_TYPE};
+    
+    public static final String XHTML_CONTENT_TYPE = "application/xhtml+xml";
+    public static final String APPLICATION_XML_CONTENT_TYPE = "application/xml";
+    public static final String TEXT_XML_CONTENT_TYPE = "text/xml";
+    
+    public static final String[] XHTML_ALLOWED_CONTENT_TYPES = {XHTML_CONTENT_TYPE, 
+        APPLICATION_XML_CONTENT_TYPE, TEXT_XML_CONTENT_TYPE};
+    
+    public static final String[] AJAX_XHTML_ALLOWED_CONTENT_TYPES = {XHTML_CONTENT_TYPE};
+
+
+    /**
+     * Indicate if the passes content type match one of the options passed. 
+     */
+    public static boolean containsContentType(String contentType, String[] allowedContentTypes)
+    {
+        if (allowedContentTypes == null)
+        {
+            return false;
+        }
+        for (int i = 0; i < allowedContentTypes.length; i++)
+        {
+            if (allowedContentTypes[i].indexOf(contentType) != -1)
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static String chooseWriterContentType(String contentTypeListString, 
+            String[] htmlContentTypes, String[] xhtmlContentTypes)
+    {
+        String[] contentTypeList = splitContentTypeListString(contentTypeListString);
+        String[] supportedContentTypeArray = HtmlRendererUtils.getSupportedContentTypes();
+        String selectedContentType = null;
+        for (int i = 0; i < supportedContentTypeArray.length; i++)
+        {
+            String supportedContentType = supportedContentTypeArray[i].trim();
+
+            for (int j = 0; j < contentTypeList.length; j++)
+            {
+                String contentType = (String) contentTypeList[j];
+
+                if (contentType.indexOf(supportedContentType) != -1)
+                {
+                    if (containsContentType(contentType, htmlContentTypes))
+                    {
+                        selectedContentType = HTML_CONTENT_TYPE;
+                    }
+                    else if (containsContentType(contentType, xhtmlContentTypes))
+                    {
+                        selectedContentType = XHTML_CONTENT_TYPE;
+                    }
+                    break;
+                }
+            }
+            if (selectedContentType != null)
+            {
+                break;
+            }
+        }
+        return selectedContentType;
+    }
+    
+    public static String[] splitContentTypeListString(String contentTypeListString)
+    {
+        String[] splittedArray = StringUtils.splitShortString(contentTypeListString, ',');
+        for (int i = 0; i < splittedArray.length; i++)
+        {
+            int semicolonIndex = splittedArray[i].indexOf(";");
+            if (semicolonIndex != -1)
+            {
+                splittedArray[i] = splittedArray[i].substring(0,semicolonIndex);
+            }
+        }
+        return splittedArray;
+    }
+    
+    public static String getContentTypeFromAcceptHeader(FacesContext context)
+    {
+        String contentTypeListString = (String) context.getExternalContext()
+            .getRequestHeaderMap().get("Accept");
+        // There is a windows mobile IE client (6.12) sending
+        // "application/vnd.wap.mms-message;*/*"
+        // Note that the Accept header should be written as 
+        // "application/vnd.wap.mms-message,*/*" ,
+        // so this is bug of the client. Anyway, this is a workaround ...
+        if (contentTypeListString != null
+                && contentTypeListString
+                        .startsWith("application/vnd.wap.mms-message;*/*"))
+        {
+            contentTypeListString = "*/*";
+        }
+        return contentTypeListString;
+    }
+
+}

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/JSFAttr.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/JSFAttr.java?rev=1535874&r1=1535873&r2=1535874&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/JSFAttr.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/JSFAttr.java Fri Oct 25 21:24:09 2013
@@ -18,6 +18,8 @@
  */
 package org.apache.myfaces.shared.renderkit;
 
+import javax.faces.event.ActionListener;
+
 
 /**
  * Constant declarations for JSF tags
@@ -166,4 +168,6 @@ public interface JSFAttr
     // HtmlSelectManyCheckbox attributes
     String LAYOUT_WIDTH_ATTR           = "layoutWidth";
 
+    //
+    String TO_FLOW_DOCUMENT_ID_ATTR    = ActionListener.TO_FLOW_DOCUMENT_ID_ATTR_NAME;
 }

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java?rev=1535874&r1=1535873&r2=1535874&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java Fri Oct 25 21:24:09 2013
@@ -1265,17 +1265,32 @@ public final class RendererUtils
         {
             final char separatorChar = UINamingContainer
                     .getSeparatorChar(facesContext);
-            if (log.isLoggable(Level.INFO))
-            {
-                log.info("Unable to find component '"
-                        + forAttr
-                        + "' (calling findComponent on component '"
-                        + uiComponent.getClientId(facesContext)
-                        + "')."
-                        + " We'll try to return a guessed client-id anyways -"
-                        + " this will be a problem if you put the referenced component"
-                        + " into a different naming-container. If this is the case, " 
-                        + "you can always use the full client-id.");
+            
+            Level level = Level.WARNING;
+            boolean productionStage = facesContext.isProjectStage(ProjectStage.Production);
+            if (productionStage)
+            {
+                level = Level.FINE;
+            }
+            if (log.isLoggable(level))
+            {
+                StringBuilder sb = new StringBuilder();
+                sb.append("Unable to find component '");
+                sb.append(forAttr);
+                sb.append("' (calling findComponent on component '");
+                sb.append(uiComponent.getClientId(facesContext));
+                sb.append("'");
+                if (!productionStage)
+                {
+                    sb.append(", viewLocation: ");
+                    sb.append(uiComponent.getAttributes().get(UIComponent.VIEW_LOCATION_KEY));
+                }
+                sb.append(").");
+                sb.append(" We'll try to return a guessed client-id anyways -");
+                sb.append(" this will be a problem if you put the referenced component");
+                sb.append(" into a different naming-container. If this is the case, ");
+                sb.append("you can always use the full client-id.");
+                log.info(sb.toString());
             }
             if (forAttr.length() > 0 && forAttr.charAt(0) == separatorChar)
             {

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyConstants.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyConstants.java?rev=1535874&r1=1535873&r2=1535874&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyConstants.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyConstants.java Fri Oct 25 21:24:09 2013
@@ -104,6 +104,8 @@ public class CommonPropertyConstants
     public static final long MAXLENGTH_PROP   = 0x2000000000L;
     public static final long SIZE_PROP        = 0x4000000000L;
     
+    public static final long ROLE_PROP        = 0x8000000000L;
+    
     public static final Map<String, Long> COMMON_PROPERTIES_KEY_BY_NAME = new HashMap<String, Long>(64,1);
     
     static
@@ -174,6 +176,9 @@ public class CommonPropertyConstants
         COMMON_PROPERTIES_KEY_BY_NAME.put("checked",    CHECKED_PROP);
         COMMON_PROPERTIES_KEY_BY_NAME.put("maxlength",  MAXLENGTH_PROP);
         COMMON_PROPERTIES_KEY_BY_NAME.put("size",       SIZE_PROP);
+        
+        // HTML5 role
+        COMMON_PROPERTIES_KEY_BY_NAME.put("role",   ROLE_PROP);
     }
     
     public static void markProperty(UIComponent component, String name)

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java?rev=1535874&r1=1535873&r2=1535874&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java Fri Oct 25 21:24:09 2013
@@ -62,6 +62,11 @@ public final class CommonPropertyUtils
             HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.TITLE_ATTR, HTML.TITLE_ATTR);
         }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ROLE_PROP) != 0)
+        {
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
+                    HTML.ROLE_ATTR, HTML.ROLE_ATTR);
+        }
     }
     
     public static final void renderUniversalPropertiesWithoutTitle(ResponseWriter writer,
@@ -78,6 +83,11 @@ public final class CommonPropertyUtils
             HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.LANG_ATTR, HTML.LANG_ATTR);
         }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ROLE_PROP) != 0)
+        {
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
+                    HTML.ROLE_ATTR, HTML.ROLE_ATTR);
+        }
     }
 
     public static final void renderStyleProperties(ResponseWriter writer,

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java?rev=1535874&r1=1535873&r2=1535874&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HTML.java Fri Oct 25 21:24:09 2013
@@ -113,19 +113,22 @@ public interface HTML
     String STYLE_ATTR = "style";
     String TITLE_ATTR = "title";
     String STYLE_CLASS_ATTR = "styleClass"; //"class" cannot be used as property name
-     
+    // Role attribute (applies for "every" html tag)
+    String ROLE_ATTR  = "role"; 
+    
     String[] UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE =
     {
         DIR_ATTR,
         LANG_ATTR,
         TITLE_ATTR,
-
+        ROLE_ATTR,
         //NOTE: if changed, please verify universal attributes in HtmlMessageRenderer !
     };
     String[] UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE_AND_TITLE =
     {
         DIR_ATTR,
         LANG_ATTR,
+        ROLE_ATTR,
     };
     String[] UNIVERSAL_ATTRIBUTES =
             (String[]) org.apache.myfaces.shared.util.ArrayUtils.concat(
@@ -503,6 +506,9 @@ public interface HTML
             UL_ATTRIBUTES,
             UNIVERSAL_ATTRIBUTES);
 
+    //head
+    String HEAD_ELEM = "head";
+    
     //body
     String BODY_ELEM = "body";
     String BODY_TARGET = BODY_ELEM;

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java?rev=1535874&r1=1535873&r2=1535874&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java Fri Oct 25 21:24:09 2013
@@ -68,7 +68,9 @@ public class HtmlButtonRendererBase
                 facesContext, uiComponent, UICommand.class);
 
         //super.decode must not be called, because value is handled here
-        if (!isReset(uiComponent) && isSubmitted(facesContext, uiComponent))
+        boolean disabled = isDisabled(facesContext, uiComponent);
+        if (!isReset(uiComponent) && isSubmitted(facesContext, uiComponent) &&
+            !disabled)
         {
             uiComponent.queueEvent(new ActionEvent(uiComponent));
 
@@ -77,7 +79,7 @@ public class HtmlButtonRendererBase
         }
         
         if (uiComponent instanceof ClientBehaviorHolder &&
-                !HtmlRendererUtils.isDisabled(uiComponent))
+                !disabled)
         {
             HtmlRendererUtils.decodeClientBehaviors(facesContext, uiComponent);
         }
@@ -111,8 +113,8 @@ public class HtmlButtonRendererBase
             || HtmlRendererUtils.isPartialOrBehaviorSubmit(facesContext, clientId);
     }
 
-    public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
-            throws IOException
+    @Override
+    public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) throws IOException
     {
         org.apache.myfaces.shared.renderkit.RendererUtils.checkParamValidity(
                 facesContext, uiComponent, UICommand.class);
@@ -299,9 +301,16 @@ public class HtmlButtonRendererBase
             writer.writeAttribute(HTML.READONLY_ATTR, Boolean.TRUE, 
                     org.apache.myfaces.shared.renderkit.JSFAttr.READONLY_ATTR);
         }
+    }
+    
+    public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
+            throws IOException
+    {
+        ResponseWriter writer = facesContext.getResponseWriter();
 
         writer.endElement(HTML.INPUT_ELEM);
         
+        FormInfo formInfo = findNestingForm(uiComponent, facesContext);
         if (formInfo != null)
         {
             HtmlFormRendererBase.renderScrollHiddenInputIfNecessary(

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlInputFileRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlInputFileRendererBase.java?rev=1535874&r1=1535873&r2=1535874&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlInputFileRendererBase.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlInputFileRendererBase.java Fri Oct 25 21:24:09 2013
@@ -28,38 +28,91 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.Part;
 import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.faces.FacesException;
+import javax.faces.application.FacesMessage;
+import javax.faces.application.ProjectStage;
+import javax.faces.component.UIViewRoot;
+import javax.faces.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.component.html.HtmlInputText;
+import org.apache.myfaces.shared.renderkit.html.util.FormInfo;
+import org.apache.myfaces.shared.renderkit.html.util.HttpPartWrapper;
+import org.apache.myfaces.shared.renderkit.html.util.JavascriptUtils;
+import org.apache.myfaces.shared.util._ComponentUtils;
 
 /**
  * @author Werner Punz (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
 
-public class HtmlInputFileRendererBase extends HtmlTextRendererBase
+public class HtmlInputFileRendererBase extends HtmlRenderer
 {
+    private static final Logger log = Logger.getLogger(HtmlInputFileRendererBase.class.getName());
+    
+    private static final String AUTOCOMPLETE_VALUE_OFF = "off";
 
     @Override
-    public void decode(FacesContext facesContext, UIComponent uiComponent)
+    public void decode(FacesContext facesContext, UIComponent component)
     {
         try
         {
-            Part part = ((HttpServletRequest) facesContext.getExternalContext().getRequest()).
-                    getPart(uiComponent.getClientId());
-            if (part == null)
-            {
-                return;
-            }
-            ((UIInput) uiComponent).setSubmittedValue(part);
+           Part part = ((HttpServletRequest) facesContext.getExternalContext().getRequest()).
+                   getPart(component.getClientId());
+
+           if (part == null)
+           {
+               return;
+           }
+           ((UIInput) component).setSubmittedValue(new HttpPartWrapper(part));
         }
         catch (IOException e)
         {
-            e.printStackTrace();
+            throw new FacesException(e);
         }
         catch (ServletException e)
         {
-            e.printStackTrace();
+            throw new FacesException(e);
+        }
+        
+        if (component instanceof ClientBehaviorHolder &&
+                !HtmlRendererUtils.isDisabled(component))
+        {
+            HtmlRendererUtils.decodeClientBehaviors(facesContext, component);
         }
     }
-
+    
+    //update spec
+    public void encodeEnd(FacesContext facesContext, UIComponent component)
+        throws IOException
+    {   
+        renderInput(facesContext, component);
+        
+        if(!facesContext.isProjectStage(ProjectStage.Production) 
+              && facesContext.isPostback() &&
+             (facesContext.getPartialViewContext().isPartialRequest() ||
+              facesContext.getPartialViewContext().isAjaxRequest()))
+        {
+            FormInfo formInfo = _ComponentUtils.findNestingForm(component, facesContext);
+            if (formInfo != null && formInfo.getForm() instanceof HtmlForm)
+            {
+                HtmlForm form = (HtmlForm) formInfo.getForm();
+                String content = form.getEnctype();
+                if(content==null || !content.contains("multipart/form-data"))
+                {
+                     //Add facemessage
+                     FacesMessage message = new FacesMessage("file upload requires a form with"+
+                            " enctype equal to multipart/form-data");
+                     facesContext.addMessage(component.getClientId(), message);
+                }
+            }
+        }
+    }
+   
     public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue)
             throws ConverterException
     {
@@ -88,4 +141,199 @@ public class HtmlInputFileRendererBase e
     {
         //the input file element cannot render a value it is readonly
     }
+    
+    protected boolean isRenderOutputEventAttributes()
+    {
+        return true;
+    }
+
+    protected void renderInput(FacesContext facesContext, UIComponent component)
+        throws IOException
+    {
+        //allow subclasses to render custom attributes by separating rendering begin and end 
+        renderInputBegin(facesContext, component);
+        renderInputEnd(facesContext, component);
+    }
+
+    //Subclasses can set the value of an attribute before, or can render a custom attribute after calling this method
+    protected void renderInputBegin(FacesContext facesContext,
+            UIComponent component) throws IOException
+    {
+        ResponseWriter writer = facesContext.getResponseWriter();
+
+        String clientId = component.getClientId(facesContext);
+
+        writer.startElement(HTML.INPUT_ELEM, component);
+        writer.writeAttribute(HTML.ID_ATTR, clientId, null);
+        writer.writeAttribute(HTML.NAME_ATTR, clientId, null);
+        
+        //allow extending classes to modify html input element's type
+        String inputHtmlType = getInputHtmlType(component);
+        writer.writeAttribute(HTML.TYPE_ATTR, inputHtmlType, null);
+
+        renderValue(facesContext, component, writer);
+
+        Map<String, List<ClientBehavior>> behaviors = null;
+        if (component instanceof ClientBehaviorHolder && JavascriptUtils.isJavascriptAllowed(
+                facesContext.getExternalContext()))
+        {
+            behaviors = ((ClientBehaviorHolder) component).getClientBehaviors();
+            
+            long commonPropertiesMarked = 0L;
+            if (isCommonPropertiesOptimizationEnabled(facesContext))
+            {
+                commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(component);
+            }
+            if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
+            {
+                CommonPropertyUtils.renderChangeEventProperty(writer, 
+                        commonPropertiesMarked, component);
+                CommonPropertyUtils.renderEventProperties(writer, 
+                        commonPropertiesMarked, component);
+                CommonPropertyUtils.renderFieldEventPropertiesWithoutOnchange(writer, 
+                        commonPropertiesMarked, component);
+            }
+            else
+            {
+                HtmlRendererUtils.renderBehaviorizedOnchangeEventHandler(facesContext, writer, component, behaviors);
+                if (isCommonEventsOptimizationEnabled(facesContext))
+                {
+                    Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(component);
+                    CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer, 
+                            commonPropertiesMarked, commonEventsMarked, component, behaviors);
+                    CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
+                        facesContext, writer, commonPropertiesMarked, commonEventsMarked, component, behaviors);
+                }
+                else
+                {
+                    HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, component, behaviors);
+                    HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
+                            facesContext, writer, component, behaviors);
+                }
+            }
+            if (isCommonPropertiesOptimizationEnabled(facesContext))
+            {
+                CommonPropertyUtils.renderInputPassthroughPropertiesWithoutDisabledAndEvents(writer, 
+                        commonPropertiesMarked, component);
+            }
+            else
+            {
+                HtmlRendererUtils.renderHTMLAttributes(writer, component, 
+                        HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
+            }
+        }
+        else
+        {
+            if (isCommonPropertiesOptimizationEnabled(facesContext))
+            {
+                CommonPropertyUtils.renderInputPassthroughPropertiesWithoutDisabled(writer, 
+                        CommonPropertyUtils.getCommonPropertiesMarked(component), component);
+            }
+            else
+            {
+                HtmlRendererUtils.renderHTMLAttributes(writer, component, 
+                        HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED);
+            }
+        }
+
+        if (isDisabled(facesContext, component))
+        {
+            writer.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE, null);
+        }
+
+        if (isAutocompleteOff(facesContext, component))
+        {
+            writer.writeAttribute(HTML.AUTOCOMPLETE_ATTR, AUTOCOMPLETE_VALUE_OFF, HTML.AUTOCOMPLETE_ATTR);
+        }
+    }
+
+    protected void renderInputEnd(FacesContext facesContext, UIComponent component) throws IOException
+    {
+        ResponseWriter writer = facesContext.getResponseWriter(); 
+
+        writer.endElement(HTML.INPUT_ELEM);
+    }
+
+    protected boolean isDisabled(FacesContext facesContext, UIComponent component)
+    {
+        //TODO: overwrite in extended HtmlTextRenderer and check for enabledOnUserRole
+        if (component instanceof HtmlInputText)
+        {
+            return ((HtmlInputText)component).isDisabled();
+        }
+
+        return org.apache.myfaces.shared.renderkit.RendererUtils.getBooleanAttribute(component, 
+                HTML.DISABLED_ATTR, false);
+        
+    }
+
+    /**
+     * If autocomplete is "on" or not set, do not render it
+     */
+    protected boolean isAutocompleteOff(FacesContext facesContext, UIComponent component)
+    {
+        if (component instanceof HtmlInputText)
+        {
+            String autocomplete = ((HtmlInputText)component).getAutocomplete();
+            if (autocomplete != null)
+            {
+                return autocomplete.equals(AUTOCOMPLETE_VALUE_OFF);
+            }
+        }
+
+        return false;
+    }
+
+    public static void renderOutputText(FacesContext facesContext,
+            UIComponent component, String text, boolean escape)
+            throws IOException
+    {
+        if (text != null)
+        {
+            ResponseWriter writer = facesContext.getResponseWriter();
+            boolean span = false;
+
+            if (component.getId() != null
+                    && !component.getId().startsWith(
+                            UIViewRoot.UNIQUE_ID_PREFIX))
+            {
+                span = true;
+
+                writer.startElement(HTML.SPAN_ELEM, component);
+
+                HtmlRendererUtils.writeIdIfNecessary(writer, component,
+                        facesContext);
+
+                HtmlRendererUtils.renderHTMLAttributes(writer, component,
+                        HTML.COMMON_PASSTROUGH_ATTRIBUTES);
+
+            }
+            else
+            {
+                span = HtmlRendererUtils
+                        .renderHTMLAttributesWithOptionalStartElement(writer,
+                                component, HTML.SPAN_ELEM,
+                                HTML.COMMON_PASSTROUGH_ATTRIBUTES);
+            }
+
+            if (escape)
+            {
+                if (log.isLoggable(Level.FINE))
+                {
+                    log.fine("renderOutputText writing '" + text + "'");
+                }
+                writer.writeText(text,
+                        org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR);
+            }
+            else
+            {
+                writer.write(text);
+            }
+
+            if (span)
+            {
+                writer.endElement(org.apache.myfaces.shared.renderkit.html.HTML.SPAN_ELEM);
+            }
+        }
+    }
 }