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 2011/11/17 01:16:50 UTC
svn commit: r1202947 [1/5] - in /myfaces/shared/trunk_4.0.x: ./ core/
core/src/main/java/org/apache/myfaces/shared/application/
core/src/main/java/org/apache/myfaces/shared/component/
core/src/main/java/org/apache/myfaces/shared/config/ core/src/main/j...
Author: lu4242
Date: Thu Nov 17 00:16:48 2011
New Revision: 1202947
URL: http://svn.apache.org/viewvc?rev=1202947&view=rev
Log:
synch code with myfaces-impl-shared
Added:
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java (with props)
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/JavascriptContext.java (with props)
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/taglib/ (with props)
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagBase.java (with props)
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagUtils.java (with props)
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentTagUtils.java (with props)
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/taglib/core/ (with props)
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/taglib/core/SelectItemTagBase.java (with props)
Modified:
myfaces/shared/trunk_4.0.x/core/pom.xml
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/component/EscapeCapable.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyConstants.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlBodyRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlGridRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMessageRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMessagesRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlOutcomeTargetButtonRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlSecretRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/ResourceUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/UnicodeEncoder.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/BaseResourceHandlerSupport.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ClassLoaderResourceLoader.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ExternalContextResourceLoader.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ResourceHandlerCache.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/resource/ResourceLoaderUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/BiLevelCacheMap.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/ClassLoaderExtension.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/ExceptionUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/ExternalContextUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/HashMapUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/NullEnumeration.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/StringUtils.java
myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/util/el/GenericMap.java
myfaces/shared/trunk_4.0.x/pom.xml
Modified: myfaces/shared/trunk_4.0.x/core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/pom.xml?rev=1202947&r1=1202946&r2=1202947&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/pom.xml (original)
+++ myfaces/shared/trunk_4.0.x/core/pom.xml Thu Nov 17 00:16:48 2011
@@ -143,7 +143,7 @@
<profile>
<id>synch-myfaces-impl-shared</id>
<properties>
- <myfaces.impl.shared.version>2.0.8-SNAPSHOT</myfaces.impl.shared.version>
+ <myfaces.impl.shared.version>2.0.10-SNAPSHOT</myfaces.impl.shared.version>
</properties>
<activation>
<property>
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java?rev=1202947&r1=1202946&r2=1202947&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java Thu Nov 17 00:16:48 2011
@@ -31,6 +31,7 @@ import javax.faces.context.ExternalConte
import javax.faces.context.FacesContext;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
+import org.apache.myfaces.shared.util.ExternalContextUtils;
import org.apache.myfaces.shared.util.WebConfigParamUtils;
/**
@@ -54,7 +55,8 @@ public class DefaultViewHandlerSupport i
/**
* Controls the size of the cache used to "remember" if a view exists or not.
*/
- @JSFWebConfigParam(defaultValue = "500", since = "2.0.2")
+ @JSFWebConfigParam(defaultValue = "500", since = "2.0.2", group="viewhandler", tags="performance", classType="java.lang.Integer",
+ desc="Controls the size of the cache used to 'remember' if a view exists or not.")
private static final String CHECKED_VIEWID_CACHE_SIZE_ATTRIBUTE = "org.apache.myfaces.CHECKED_VIEWID_CACHE_SIZE";
private static final int CHECKED_VIEWID_CACHE_DEFAULT_SIZE = 500;
@@ -62,7 +64,8 @@ public class DefaultViewHandlerSupport i
* Enable or disable a cache used to "remember" if a view exists or not and reduce the impact of
* sucesive calls to ExternalContext.getResource().
*/
- @JSFWebConfigParam(defaultValue = "true", since = "2.0.2")
+ @JSFWebConfigParam(defaultValue = "true", since = "2.0.2", expectedValues="true, false", group="viewhandler", tags="performance",
+ desc="Enable or disable a cache used to 'remember' if a view exists or not and reduce the impact of sucesive calls to ExternalContext.getResource().")
private static final String CHECKED_VIEWID_CACHE_ENABLED_ATTRIBUTE = "org.apache.myfaces.CHECKED_VIEWID_CACHE_ENABLED";
private static final boolean CHECKED_VIEWID_CACHE_ENABLED_DEFAULT = true;
@@ -84,6 +87,16 @@ public class DefaultViewHandlerSupport i
else if(mapping.isPrefixMapping())
{
viewId = handlePrefixMapping(viewId,mapping.getPrefix());
+
+ // A viewId that is equals to the prefix mapping on servlet mode is
+ // considered invalid, because jsp vdl will use RequestDispatcher and cause
+ // a loop that ends in a exception. Note in portlet mode the view
+ // could be encoded as a query param, so the viewId could be valid.
+ if (viewId != null && viewId.equals(mapping.getPrefix()) &&
+ !ExternalContextUtils.isPortlet(context.getExternalContext()))
+ {
+ throw new InvalidViewIdException();
+ }
}
else if (viewId != null && mapping.getUrlPattern().startsWith(viewId))
{
@@ -116,6 +129,16 @@ public class DefaultViewHandlerSupport i
if(viewId != null)
{
+ // A viewId that is equals to the prefix mapping on servlet mode is
+ // considered invalid, because jsp vdl will use RequestDispatcher and cause
+ // a loop that ends in a exception. Note in portlet mode the view
+ // could be encoded as a query param, so the viewId could be valid.
+ if (viewId != null && viewId.equals(mapping.getPrefix()) &&
+ !ExternalContextUtils.isPortlet(context.getExternalContext()))
+ {
+ throw new InvalidViewIdException();
+ }
+
return (checkResourceExists(context,viewId) ? viewId : null);
}
}
@@ -149,6 +172,7 @@ public class DefaultViewHandlerSupport i
{
if (mapping.isExtensionMapping())
{
+ //See JSF 2.0 section 7.5.2
String[] contextSuffixes = getContextSuffix(context);
boolean founded = false;
for (String contextSuffix : contextSuffixes)
@@ -163,15 +187,27 @@ public class DefaultViewHandlerSupport i
}
if (!founded)
{
- if(viewId.lastIndexOf(".") != -1 )
+ //See JSF 2.0 section 7.5.2
+ // - If the argument viewId has an extension, and this extension is mapping, the result is contextPath + viewId
+ //
+ // -= Leonardo Uribe =- It is evident that when the page is generated, the derived viewId will end with the
+ // right contextSuffix, and a navigation entry on faces-config.xml should use such id, this is just a workaroud
+ // for usability. There is a potential risk that change the mapping in a webapp make the same application fail,
+ // so use viewIds ending with mapping extensions is not a good practice.
+ if (viewId.endsWith(mapping.getExtension()))
+ {
+ builder.append(viewId);
+ }
+ else if(viewId.lastIndexOf(".") != -1 )
{
builder.append(viewId.substring(0,viewId.lastIndexOf(".")));
+ builder.append(contextSuffixes[0]);
}
else
{
builder.append(viewId);
+ builder.append(contextSuffixes[0]);
}
- builder.append(contextSuffixes[0]);
}
}
else
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/component/EscapeCapable.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/component/EscapeCapable.java?rev=1202947&r1=1202946&r2=1202947&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/component/EscapeCapable.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/component/EscapeCapable.java Thu Nov 17 00:16:48 2011
@@ -26,7 +26,8 @@ package org.apache.myfaces.shared.compon
* @author Grant Smith (latest modification by $Author$)
*/
-public interface EscapeCapable {
+public interface EscapeCapable
+{
boolean isEscape();
void setEscape(boolean escape);
}
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java?rev=1202947&r1=1202946&r2=1202947&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java Thu Nov 17 00:16:48 2011
@@ -18,7 +18,6 @@
*/
package org.apache.myfaces.shared.config;
-import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.context.ExternalContext;
@@ -26,6 +25,7 @@ import javax.servlet.ServletContext;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
import org.apache.myfaces.shared.util.ClassUtils;
+import org.apache.myfaces.shared.util.WebConfigParamUtils;
/**
* Holds all configuration init parameters (from web.xml) that are independent
@@ -50,6 +50,11 @@ public class MyfacesConfig
private static final String APPLICATION_MAP_PARAM_NAME = MyfacesConfig.class.getName();
+ /**
+ * Set the virtual path used to serve resources using tomahawk addResource API. Note ExtensionsFilter should
+ * be able to receive request on the prefix used here.
+ */
+ @JSFWebConfigParam(tags="tomahawk")
public static final String INIT_PARAM_RESOURCE_VIRTUAL_PATH = "org.apache.myfaces.RESOURCE_VIRTUAL_PATH";
public static final String INIT_PARAM_RESOURCE_VIRTUAL_PATH_DEFAULT = "/faces/myFacesExtensionResource";
@@ -58,7 +63,8 @@ public class MyfacesConfig
* i.e. additional line separators and whitespace will be written, that do not
* influence the HTML code. Default: "true"
*/
- @JSFWebConfigParam(defaultValue="true", expectedValues="true,false",since="1.1")
+ @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1",
+ ignoreUpperLowerCase=true, group="render")
private static final String INIT_PARAM_PRETTY_HTML = "org.apache.myfaces.PRETTY_HTML";
private static final boolean INIT_PARAM_PRETTY_HTML_DEFAULT = true;
@@ -70,14 +76,16 @@ public class MyfacesConfig
* added as url parameters.
* Default: "true"
*/
- @JSFWebConfigParam(defaultValue="true", expectedValues="true,false",since="1.1")
+ @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1",
+ ignoreUpperLowerCase=true, group="render")
private static final String INIT_PARAM_ALLOW_JAVASCRIPT = "org.apache.myfaces.ALLOW_JAVASCRIPT";
private static final boolean INIT_PARAM_ALLOW_JAVASCRIPT_DEFAULT = true;
/**
- *
+ * Deprecated: tomahawk specific param to detect javascript, but it is no longer valid anymore.
*/
- @JSFWebConfigParam(defaultValue="false", expectedValues="true,false",since="1.1")
+ @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.1",
+ ignoreUpperLowerCase=true, deprecated=true, tags="tomahawk", group="render")
private static final String INIT_PARAM_DETECT_JAVASCRIPT = "org.apache.myfaces.DETECT_JAVASCRIPT";
private static final boolean INIT_PARAM_DETECT_JAVASCRIPT_DEFAULT = false;
@@ -88,7 +96,8 @@ public class MyfacesConfig
* if you trigger a link or button action that stays on the same page.
* Default: "false"
*/
- @JSFWebConfigParam(defaultValue="false", expectedValues="true,false",since="1.1")
+ @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.1",
+ ignoreUpperLowerCase=true, tags="tomahawk")
private static final String INIT_PARAM_AUTO_SCROLL = "org.apache.myfaces.AUTO_SCROLL";
private static final boolean INIT_PARAM_AUTO_SCROLL_DEFAULT = false;
@@ -102,9 +111,12 @@ public class MyfacesConfig
* StreamingAddResource instead of DefaultAddResource if you want to
* gain performance.
*/
- @JSFWebConfigParam(defaultValue="org.apache.myfaces. renderkit.html.util. DefaultAddResource",since="1.1")
+ @JSFWebConfigParam(defaultValue="org.apache.myfaces. renderkit.html.util. DefaultAddResource",since="1.1",
+ desc="Tomahawk specific: Indicate the class responsible to place scripts and css using " +
+ "tomahawk AddResource API", tags="tomahawk")
private static final String INIT_PARAM_ADD_RESOURCE_CLASS = "org.apache.myfaces.ADD_RESOURCE_CLASS";
- private static final String INIT_PARAM_ADD_RESOURCE_CLASS_DEFAULT = "org.apache.myfaces.renderkit.html.util.DefaultAddResource";
+ private static final String INIT_PARAM_ADD_RESOURCE_CLASS_DEFAULT =
+ "org.apache.myfaces.renderkit.html.util.DefaultAddResource";
/**
* Tomahawk specific: A very common problem in configuring MyFaces-web-applications
@@ -118,42 +130,76 @@ public class MyfacesConfig
*
* In tomahawk for JSF 2.0 since version 1.1.11, this param is set by default to false, otherwise is true.
*/
- @JSFWebConfigParam(defaultValue="for JSF 2.0 since 1.1.11 false, otherwise true", expectedValues="true,false",since="1.1")
+ @JSFWebConfigParam(defaultValue="for JSF 2.0 since 1.1.11 false, otherwise true",
+ expectedValues="true, false, on, off, yes, no",since="1.1", ignoreUpperLowerCase=true,
+ desc="Tomahawk specific: This parameter will check for a properly configured Extensions-Filter if " +
+ "it is needed by the web-app.", tags="tomahawk")
private static final String INIT_CHECK_EXTENSIONS_FILTER = "org.apache.myfaces.CHECK_EXTENSIONS_FILTER";
private static final boolean INIT_CHECK_EXTENSIONS_FILTER_DEFAULT = false;
/**
- *
+ * Tomahawk specific: Interpret "readonly" property as "disable" for select components like t:selectOneRow.
*/
- @JSFWebConfigParam(defaultValue="true", expectedValues="true,false",since="1.1")
- private static final String INIT_READONLY_AS_DISABLED_FOR_SELECT = "org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS";
+ @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1",
+ ignoreUpperLowerCase=true, tags="tomahawk", group="render")
+ private static final String INIT_READONLY_AS_DISABLED_FOR_SELECT =
+ "org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS";
private static final boolean INIT_READONLY_AS_DISABLED_FOR_SELECT_DEFAULT = true;
/**
- *
+ * Set the time in seconds that check for updates of web.xml and faces-config descriptors and
+ * refresh the configuration.
+ * This param is valid only if project stage is not production. Set this param to 0 disable this feature.
*/
- @JSFWebConfigParam(defaultValue="2",since="1.1")
+ @JSFWebConfigParam(defaultValue="2",since="1.1", classType="java.lang.Long")
public static final String INIT_PARAM_CONFIG_REFRESH_PERIOD = "org.apache.myfaces.CONFIG_REFRESH_PERIOD";
public static final long INIT_PARAM_CONFIG_REFRESH_PERIOD_DEFAULT = 2;
/**
- *
+ * Set the view state using a javascript function instead a hidden input field.
*/
- @JSFWebConfigParam(defaultValue="false", expectedValues="true,false",since="1.1")
+ @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.1",
+ ignoreUpperLowerCase=true, deprecated=true, group="state")
private static final String INIT_PARAM_VIEWSTATE_JAVASCRIPT = "org.apache.myfaces.VIEWSTATE_JAVASCRIPT";
private static final boolean INIT_PARAM_VIEWSTATE_JAVASCRIPT_DEFAULT = false;
/**
+ * Define if the input field that should store the state (javax.faces.ViewState) should render
+ * id="javax.faces.ViewState".
*
+ * JSF API 1.2 defines a "javax.faces.ViewState" client parameter, that must be rendered as both the "name"
+ * and the "id" attribute of the hidden input that is rendered for the purpose of state saving
+ * (see ResponseStateManager.VIEW_STATE_PARAM).
+ * Actually this causes duplicate id attributes and thus invalid XHTML pages when multiple forms are rendered on
+ * one page. With the org.apache.myfaces.RENDER_VIEWSTATE_ID context parameter you can tune this behaviour.
+ * <br/>Set it to
+ * <ul><li>true - to render JSF 1.2 compliant id attributes (that might cause invalid XHTML), or</li>
+ * <li>false - to omit rendering of the id attribute (which is only needed for very special
+ * AJAX/Javascript components)</li></ul>
+ * Default value is: true (for backwards compatibility and JSF 1.2 compliancy)
*/
- @JSFWebConfigParam(defaultValue="true", expectedValues="true,false",since="1.1")
+ @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1",
+ ignoreUpperLowerCase=true, group="state")
private static final String INIT_PARAM_RENDER_VIEWSTATE_ID = "org.apache.myfaces.RENDER_VIEWSTATE_ID";
private static final boolean INIT_PARAM_RENDER_VIEWSTATE_ID_DEFAULT = true;
/**
- *
+ * Use "&amp;" entity instead a plain "&" character within HTML.
+ * <p>W3C recommends to use the "&amp;" entity instead of a plain "&" character within HTML.
+ * This also applies to attribute values and thus to the "href" attribute of <a> elements as well.
+ * Even more, when XHTML is used as output the usage of plain "&" characters is forbidden and would lead to
+ * invalid XML code.
+ * Therefore, since version 1.1.6 MyFaces renders the correct "&amp;" entity for links.</p>
+ * <p>The init parameter
+ * org.apache.myfaces.STRICT_XHTML_LINKS makes it possible to restore the old behaviour and to make MyFaces
+ * "bug compatible" to the Sun RI which renders plain "&" chars in links as well.</p>
+ * <p>
+ * See: <a href="http://www.w3.org/TR/html401/charset.html#h-5.3.2">HTML 4.01 Specification</a>
+ * See: <a href="http://issues.apache.org/jira/browse/MYFACES-1774">Jira: MYFACES-1774</a>
+ * </p>
*/
- @JSFWebConfigParam(defaultValue="true", expectedValues="true,false",since="1.1")
+ @JSFWebConfigParam(defaultValue="true", expectedValues="true, false, on, off, yes, no",since="1.1.6",
+ ignoreUpperLowerCase=true, group="render")
private static final String INIT_PARAM_STRICT_XHTML_LINKS = "org.apache.myfaces.STRICT_XHTML_LINKS";
private static final boolean INIT_PARAM_STRICT_XHTML_LINKS_DEFAULT = true;
@@ -163,46 +209,60 @@ public class MyfacesConfig
* because jsf ri does not render javascript on onclick method for button,
* so myfaces should do this.
*/
- @JSFWebConfigParam(defaultValue="false", expectedValues="true,false",since="1.2.3")
- private static final String INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON = "org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON";
+ @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.2.3",
+ ignoreUpperLowerCase=true, group="render")
+ private static final String INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON =
+ "org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON";
private static final boolean INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT= false;
/**
- * This param renders hidden fields at the end of h:form for link params when h:commandLink + f:param is used, instead
- * use javascript to create them. Set this param to true also enables org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON
- * automatically to ensure consistency. This feature is required to support Windows Mobile 6, because in this environment,
- * document.createElement() and form.appendChild() javascript methods are not supported.
- */
- @JSFWebConfigParam(defaultValue="false", expectedValues="true,false",since="1.2.9")
- private static final String INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS = "org.apache.myfaces.RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS";
+ * This param renders hidden fields at the end of h:form for link params when h:commandLink + f:param is used,
+ * instead use javascript to create them. Set this param to true also enables
+ * org.apache.myfaces.RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON
+ * automatically to ensure consistency. This feature is required to support Windows Mobile 6, because in
+ * this environment, document.createElement() and form.appendChild() javascript methods are not supported.
+ */
+ @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.2.9",
+ ignoreUpperLowerCase=true, group="render")
+ private static final String INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS =
+ "org.apache.myfaces.RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS";
private static final boolean INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS_DEFAULT= false;
/**
* Add a code that save the form before submit using a
* link (call to window.external.AutoCompleteSaveForm(form) ). It's a bug on IE.
*/
- @JSFWebConfigParam(defaultValue="false", expectedValues="true,false",since="1.1")
+ @JSFWebConfigParam(defaultValue="false", expectedValues="true, false, on, off, yes, no",since="1.1",
+ ignoreUpperLowerCase=true, group="render")
private static final String INIT_PARAM_SAVE_FORM_SUBMIT_LINK_IE = "org.apache.myfaces.SAVE_FORM_SUBMIT_LINK_IE";
private static final boolean INIT_PARAM_SAVE_FORM_SUBMIT_LINK_IE_DEFAULT = false;
/**
+ * Define an alternate class name that will be used to initialize MyFaces, instead the default
+ * javax.faces.webapp.FacesServlet.
*
+ * <p>This helps MyFaces to detect the mappings and other additional configuration used to setup the
+ * environment, and prevent abort initialization if no FacesServlet config is detected.
+ * </p>
*/
@JSFWebConfigParam(since="1.2.7")
private static final String INIT_PARAM_DELEGATE_FACES_SERVLET = "org.apache.myfaces.DELEGATE_FACES_SERVLET";
/**
- * Indicate if the facelet associated to the view should be reapplied when the view is refreshed. Default mode is "auto".
+ * Indicate if the facelet associated to the view should be reapplied when the view is refreshed.
+ * Default mode is "auto".
*
* <p>This param is only valid when partial state saving is on.
- * If this is set as true, the tag-handlers are always reapplied before render view, like in facelets 1.1.x, allowing
- * c:if work correctly to "toggle" components based on a value changed on invoke application phase.
+ * If this is set as true, the tag-handlers are always reapplied before render view, like in facelets 1.1.x,
+ * allowing c:if work correctly to "toggle" components based on a value changed on invoke application phase.
* If the param is set as "auto", the implementation check if c:if, c:forEach,
* c:choose and ui:include with src=ELExpression is used on the page and if that so, mark the view
* to be refreshed.</p>
*/
- @JSFWebConfigParam(since="2.0", defaultValue="auto", expectedValues="true,false,auto")
- public final static String INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS = "org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS";
+ @JSFWebConfigParam(since="2.0", defaultValue="auto", expectedValues="true,false,auto", tags="performance",
+ ignoreUpperLowerCase=true, group="state")
+ public final static String INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS =
+ "org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS";
public final static String INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_DEFAULT = "auto";
/**
@@ -214,41 +274,72 @@ public class MyfacesConfig
* c:choose and ui:include with src=ELExpression are marked to be restored fully, so state
* is preserved between request.</p>
*/
- @JSFWebConfigParam(since="2.0", defaultValue="false")
- public final static String INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE = "org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE";
+ @JSFWebConfigParam(since="2.0", defaultValue="false", expectedValues="true, false, on, off, yes, no",
+ tags="performance", ignoreUpperLowerCase=true, group="state")
+ public final static String INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE =
+ "org.apache.myfaces.REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE";
public final static boolean INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT = false;
/**
* If set to <code>true</code>, tag library XML files and faces config XML files using schema
* will be validated during application start up
*/
- @JSFWebConfigParam(since="2.0", expectedValues="true,false")
+ @JSFWebConfigParam(since="2.0", expectedValues="true, false, on, off, yes, no", ignoreUpperLowerCase=true)
public final static String INIT_PARAM_VALIDATE_XML = "org.apache.myfaces.VALIDATE_XML";
public final static boolean INIT_PARAM_VALIDATE_XML_DEFAULT = false;
/**
* 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", defaultValue="true")
- public final static String INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG = "org.apache.myfaces.WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG";
+ @JSFWebConfigParam(since="2.0.1", expectedValues="true, false, on, off, yes, no", defaultValue="true",
+ 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;
/**
* If set true, render the form submit script inline, as in myfaces core 1.2 and earlier versions
*/
- @JSFWebConfigParam(since="2.0.2", expectedValues="true,false", defaultValue="false")
- public final static String INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE = "org.apache.myfaces.RENDER_FORM_SUBMIT_SCRIPT_INLINE";
+ @JSFWebConfigParam(since="2.0.2", expectedValues="true, false, on, off, yes, no", defaultValue="false",
+ ignoreUpperLowerCase=true, group="render")
+ public final static String INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE =
+ "org.apache.myfaces.RENDER_FORM_SUBMIT_SCRIPT_INLINE";
public final static boolean INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE_DEFAULT = false;
/**
- * Enable/disable DebugPhaseListener feature, with provide useful information about ValueHolder variables (submittedValue, localValue, value).
- * Note evaluate those getters for each component could cause some unwanted side effects when using "access" type scopes like on MyFaces CODI.
+ * Enable/disable DebugPhaseListener feature, with provide useful information about ValueHolder
+ * variables (submittedValue, localValue, value).
+ * Note evaluate those getters for each component could cause some unwanted side effects when
+ * using "access" type scopes like on MyFaces CODI.
* This param only has effect when project stage is Development.
*/
@JSFWebConfigParam(since="2.0.8")
public final static String INIT_PARAM_DEBUG_PHASE_LISTENER = "org.apache.myfaces.DEBUG_PHASE_LISTENER";
public final static boolean INIT_PARAM_DEBUG_PHASE_LISTENER_DEFAULT = false;
+ /**
+ * Detect if a target (usually head) should be update for the current view in an ajax render
+ * operation. This is activated if a css or js resource is added dynamically by effect of a refresh
+ * (c:if, ui:include src="#{...}" or a manipulation of the tree). This ensures ajax updates of content
+ * using ui:include will be consistent. Note this behavior is a myfaces specific extension, so to ensure strict compatibility with the spec,
+ * set this param to false (default false).
+ */
+ @JSFWebConfigParam(since="2.0.10", expectedValues="true, false", defaultValue="false")
+ public final static String INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX =
+ "org.apache.myfaces.STRICT_JSF_2_REFRESH_TARGET_AJAX";
+ public final static boolean INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX_DEFAULT = false;
+
+ /**
+ * Change default getType() behavior for composite component EL resolver, from return null (see JSF 2_0 spec section 5_6_2_2) to
+ * use the metadata information added by composite:attribute, ensuring components working with chained EL expressions to find the
+ * right type when a getType() is called over the source EL expression.
+ *
+ * To ensure strict compatibility with the spec set this param to true (by default is false, so the change is enabled by default).
+ */
+ @JSFWebConfigParam(since="2.0.10", expectedValues="true, false", defaultValue="false", group="EL")
+ public final static String INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER = "org.apache.myfaces.STRICT_JSF_2_CC_EL_RESOLVER";
+ public final static boolean INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT = false;
+
private boolean _prettyHtml;
private boolean _detectJavascript;
private boolean _allowJavascript;
@@ -272,6 +363,8 @@ public class MyfacesConfig
private boolean _wrapScriptContentWithXmlCommentTag;
private boolean _renderFormSubmitScriptInline;
private boolean _debugPhaseListenerEnabled;
+ private boolean _strictJsf2RefreshTargetAjax;
+ private boolean _strictJsf2CCELResolver;
private static final boolean TOMAHAWK_AVAILABLE;
private static final boolean MYFACES_IMPL_AVAILABLE;
@@ -364,9 +457,12 @@ public class MyfacesConfig
setCheckExtensionsFilter(false);
setRenderFormSubmitScriptInline(INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE_DEFAULT);
setDebugPhaseListenerEnabled(INIT_PARAM_DEBUG_PHASE_LISTENER_DEFAULT);
+ setStrictJsf2RefreshTargetAjax(INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX_DEFAULT);
+ setStrictJsf2CCELResolver(INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT);
}
- private static MyfacesConfig createAndInitializeMyFacesConfig(ExternalContext extCtx) {
+ private static MyfacesConfig createAndInitializeMyFacesConfig(ExternalContext extCtx)
+ {
MyfacesConfig myfacesConfig = new MyfacesConfig();
@@ -375,22 +471,26 @@ public class MyfacesConfig
myfacesConfig.setAllowJavascript(getBooleanInitParameter(extCtx, INIT_PARAM_ALLOW_JAVASCRIPT,
INIT_PARAM_ALLOW_JAVASCRIPT_DEFAULT));
- myfacesConfig.setRenderClearJavascriptOnButton(getBooleanInitParameter(extCtx, INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON,
+ myfacesConfig.setRenderClearJavascriptOnButton(getBooleanInitParameter(extCtx,
+ INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON,
INIT_PARAM_RENDER_CLEAR_JAVASCRIPT_FOR_BUTTON_DEFAULT));
- myfacesConfig.setRenderHiddenFieldsForLinkParams(getBooleanInitParameter(extCtx, INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS,
+ myfacesConfig.setRenderHiddenFieldsForLinkParams(getBooleanInitParameter(extCtx,
+ INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS,
INIT_PARAM_RENDER_HIDDEN_FIELDS_FOR_LINK_PARAMS_DEFAULT));
myfacesConfig.setSaveFormSubmitLinkIE(getBooleanInitParameter(extCtx, INIT_PARAM_SAVE_FORM_SUBMIT_LINK_IE,
INIT_PARAM_SAVE_FORM_SUBMIT_LINK_IE_DEFAULT));
- myfacesConfig.setReadonlyAsDisabledForSelect(getBooleanInitParameter(extCtx, INIT_READONLY_AS_DISABLED_FOR_SELECT,
+ myfacesConfig.setReadonlyAsDisabledForSelect(getBooleanInitParameter(extCtx,
+ INIT_READONLY_AS_DISABLED_FOR_SELECT,
INIT_READONLY_AS_DISABLED_FOR_SELECT_DEFAULT));
myfacesConfig.setRenderViewStateId(getBooleanInitParameter(extCtx, INIT_PARAM_RENDER_VIEWSTATE_ID,
INIT_PARAM_RENDER_VIEWSTATE_ID_DEFAULT));
myfacesConfig.setStrictXhtmlLinks(getBooleanInitParameter(extCtx, INIT_PARAM_STRICT_XHTML_LINKS,
INIT_PARAM_STRICT_XHTML_LINKS_DEFAULT));
- myfacesConfig.setRenderFormSubmitScriptInline(getBooleanInitParameter(extCtx, INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE,
+ myfacesConfig.setRenderFormSubmitScriptInline(getBooleanInitParameter(extCtx,
+ INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE,
INIT_PARAM_RENDER_FORM_SUBMIT_SCRIPT_INLINE_DEFAULT));
myfacesConfig.setConfigRefreshPeriod(getLongInitParameter(extCtx, INIT_PARAM_CONFIG_REFRESH_PERIOD,
@@ -401,7 +501,8 @@ public class MyfacesConfig
myfacesConfig.setDelegateFacesServlet(extCtx.getInitParameter(INIT_PARAM_DELEGATE_FACES_SERVLET));
- String refreshTransientBuildOnPSS = getStringInitParameter(extCtx, INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS,
+ String refreshTransientBuildOnPSS = getStringInitParameter(extCtx,
+ INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS,
INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_DEFAULT);
if (refreshTransientBuildOnPSS == null)
@@ -431,13 +532,21 @@ public class MyfacesConfig
INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE,
INIT_PARAM_REFRESH_TRANSIENT_BUILD_ON_PSS_PRESERVE_STATE_DEFAULT));
- myfacesConfig.setValidateXML(getBooleanInitParameter(extCtx, INIT_PARAM_VALIDATE_XML, INIT_PARAM_VALIDATE_XML_DEFAULT));
+ myfacesConfig.setValidateXML(getBooleanInitParameter(extCtx, INIT_PARAM_VALIDATE_XML,
+ INIT_PARAM_VALIDATE_XML_DEFAULT));
myfacesConfig.setWrapScriptContentWithXmlCommentTag(getBooleanInitParameter(extCtx,
- INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG, INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT));
+ INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG,
+ INIT_PARAM_WRAP_SCRIPT_CONTENT_WITH_XML_COMMENT_TAG_DEFAULT));
myfacesConfig.setDebugPhaseListenerEnabled(getBooleanInitParameter(extCtx, INIT_PARAM_DEBUG_PHASE_LISTENER,
INIT_PARAM_DEBUG_PHASE_LISTENER_DEFAULT));
+
+ myfacesConfig.setStrictJsf2RefreshTargetAjax(WebConfigParamUtils.getBooleanInitParameter(extCtx,
+ INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX, INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX_DEFAULT));
+
+ myfacesConfig.setStrictJsf2CCELResolver(WebConfigParamUtils.getBooleanInitParameter(extCtx,
+ INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER, INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT));
if (TOMAHAWK_AVAILABLE)
{
@@ -453,7 +562,7 @@ public class MyfacesConfig
myfacesConfig.setCheckExtensionsFilter(getBooleanInitParameter(extCtx, INIT_CHECK_EXTENSIONS_FILTER,
INIT_CHECK_EXTENSIONS_FILTER_DEFAULT));
-
+ /*
if(RI_IMPL_AVAILABLE)
{
if(log.isLoggable(Level.INFO))
@@ -468,20 +577,24 @@ public class MyfacesConfig
{
log.info("Starting up Tomahawk on the MyFaces-JSF-Implementation");
}
- }
+ }*/
}
+ /*
else
{
if (log.isLoggable(Level.INFO))
{
- log.info("Tomahawk jar not available. Autoscrolling, DetectJavascript, AddResourceClass and CheckExtensionsFilter are disabled now.");
+ log.info("Tomahawk jar not available. Autoscrolling, DetectJavascript, "+
+ "AddResourceClass and CheckExtensionsFilter are disabled now.");
}
- }
+ }*/
+ /*
if(RI_IMPL_AVAILABLE && MYFACES_IMPL_AVAILABLE)
{
- log.severe("Both MyFaces and the RI are on your classpath. Please make sure to use only one of the two JSF-implementations.");
- }
+ log.severe("Both MyFaces and the RI are on your classpath. Please make sure to"+
+ " use only one of the two JSF-implementations.");
+ }*/
return myfacesConfig;
}
@@ -492,20 +605,24 @@ public class MyfacesConfig
String strValue = externalContext.getInitParameter(paramName);
if (strValue == null)
{
- if (log.isLoggable(Level.INFO)) log.info("No context init parameter '" + paramName + "' found, using default value " + defaultValue);
+ //if (log.isLoggable(Level.INFO)) log.info("No context init parameter '" +
+ // paramName + "' found, using default value " + defaultValue);
return defaultValue;
}
- else if (strValue.equalsIgnoreCase("true") || strValue.equalsIgnoreCase("on") || strValue.equalsIgnoreCase("yes"))
+ else if (strValue.equalsIgnoreCase("true") || strValue.equalsIgnoreCase("on") ||
+ strValue.equalsIgnoreCase("yes"))
{
return true;
}
- else if (strValue.equalsIgnoreCase("false") || strValue.equalsIgnoreCase("off") || strValue.equalsIgnoreCase("no"))
+ else if (strValue.equalsIgnoreCase("false") || strValue.equalsIgnoreCase("off") ||
+ strValue.equalsIgnoreCase("no"))
{
return false;
}
else
{
- if (log.isLoggable(Level.WARNING)) log.warning("Wrong context init parameter '" + paramName + "' (='" + strValue + "'), using default value " + defaultValue);
+ //if (log.isLoggable(Level.WARNING)) log.warning("Wrong context init parameter '" +
+ //paramName + "' (='" + strValue + "'), using default value " + defaultValue);
return defaultValue;
}
}
@@ -517,7 +634,9 @@ public class MyfacesConfig
String strValue = externalContext.getInitParameter(paramName);
if (strValue == null)
{
- if (log.isLoggable(Level.INFO)) log.info("No context init parameter '" + paramName + "' found, using default value " + defaultValue); //defaultValue==null should not be a problem here
+ //if (log.isLoggable(Level.INFO)) log.info("No context init parameter '" + paramName +
+ //"' found, using default value " + defaultValue); //defaultValue==null should not be
+ //a problem here
return defaultValue;
}
@@ -526,19 +645,25 @@ public class MyfacesConfig
private static long getLongInitParameter(ExternalContext externalContext,
String paramName,
- long defaultValue) {
+ long defaultValue)
+ {
String strValue = externalContext.getInitParameter(paramName);
if (strValue == null)
{
- if (log.isLoggable(Level.INFO)) log.info("No context init parameter '" +paramName +"' found, using default value " +defaultValue);
+ //if (log.isLoggable(Level.INFO)) log.info("No context init parameter '" +paramName +
+ //"' found, using default value " +defaultValue);
return defaultValue;
}
else
{
- try {
+ try
+ {
return Long.parseLong(strValue);
- } catch (NumberFormatException e) {
- if (log.isLoggable(Level.WARNING)) log.warning("Wrong context init parameter '" + paramName + "' (='" + strValue + "'), using default value " + defaultValue);
+ }
+ catch (NumberFormatException e)
+ {
+ //if (log.isLoggable(Level.WARNING)) log.warning("Wrong context init parameter '" +
+ //paramName + "' (='" + strValue + "'), using default value " + defaultValue);
}
return defaultValue;
}
@@ -598,20 +723,23 @@ public class MyfacesConfig
/**
* JSF API 1.2 defines a "javax.faces.ViewState" client parameter, that must be rendered as both the "name"
* and the "id" attribute of the hidden input that is rendered for the purpose of state saving
- * (see <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/render/ResponseStateManager.html#VIEW_STATE_PARAM">API</a>).
+ * (see ResponseStateManager.VIEW_STATE_PARAM).
* Actually this causes duplicate id attributes and thus invalid XHTML pages when multiple forms are rendered on
* one page. With the {@link #INIT_PARAM_RENDER_VIEWSTATE_ID} context parameter you can tune this behaviour.
* <br/>Set it to
* <ul><li>true - to render JSF 1.2 compliant id attributes (that might cause invalid XHTML), or</li>
- * <li>false - to omit rendering of the id attribute (which is only needed for very special AJAX/Javascript components)</li></ul>
+ * <li>false - to omit rendering of the id attribute (which is only needed for very special AJAX/Javascript
+ * components)</li></ul>
* Default value is: true (for backwards compatibility and JSF 1.2 compliancy)
* @return true, if the client state hidden input "javax.faces.ViewState" id attribute should be rendered
*/
- public boolean isRenderViewStateId() {
+ public boolean isRenderViewStateId()
+ {
return _renderViewStateId;
}
- public void setRenderViewStateId(boolean renderViewStateId) {
+ public void setRenderViewStateId(boolean renderViewStateId)
+ {
_renderViewStateId = renderViewStateId;
}
@@ -626,14 +754,16 @@ public class MyfacesConfig
* "bug compatible" to the Sun RI which renders plain "&" chars in links as well.</p>
* @see <a href="http://www.w3.org/TR/html401/charset.html#h-5.3.2">HTML 4.01 Specification</a>
* @see <a href="http://issues.apache.org/jira/browse/MYFACES-1774">Jira: MYFACES-1774</a>
- * @return true if ampersand characters ("&") should be correctly rendered as "&amp;" entities within link urls (=default),
- * false for old (XHTML incompatible) behaviour
+ * @return true if ampersand characters ("&") should be correctly rendered as "&amp;" entities
+ * within link urls (=default), false for old (XHTML incompatible) behaviour
*/
- public boolean isStrictXhtmlLinks() {
+ public boolean isStrictXhtmlLinks()
+ {
return _strictXhtmlLinks;
}
- public void setStrictXhtmlLinks(boolean strictXhtmlLinks) {
+ public void setStrictXhtmlLinks(boolean strictXhtmlLinks)
+ {
_strictXhtmlLinks = strictXhtmlLinks;
}
@@ -853,4 +983,24 @@ public class MyfacesConfig
{
this._debugPhaseListenerEnabled = debugPhaseListener;
}
+
+ public boolean isStrictJsf2RefreshTargetAjax()
+ {
+ return _strictJsf2RefreshTargetAjax;
+ }
+
+ public void setStrictJsf2RefreshTargetAjax(boolean strictJsf2RefreshTargetAjax)
+ {
+ this._strictJsf2RefreshTargetAjax = strictJsf2RefreshTargetAjax;
+ }
+
+ public boolean isStrictJsf2CCELResolver()
+ {
+ return _strictJsf2CCELResolver;
+ }
+
+ public void setStrictJsf2CCELResolver(boolean strictJsf2CCELResolver)
+ {
+ this._strictJsf2CCELResolver = strictJsf2CCELResolver;
+ }
}
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java?rev=1202947&r1=1202946&r2=1202947&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/context/flash/FlashImpl.java Thu Nov 17 00:16:48 2011
@@ -57,7 +57,9 @@ public class FlashImpl extends Flash
private static final Logger logger = Logger.getLogger(FlashImpl.class.getName());
/**
- * Defines whether flash scope is disabled.
+ * Defines whether flash scope is disabled, preventing add the Flash cookie to the response.
+ *
+ * <p>This is useful for applications that does not require to use flash scope, and instead uses other scopes.</p>
*/
@JSFWebConfigParam(defaultValue="false",since="2.0.5")
private static final String FLASH_SCOPE_DISABLED_PARAM = "org.apache.myfaces.FLASH_SCOPE_DISABLED";
@@ -629,7 +631,9 @@ public class FlashImpl extends Flash
// to this request object
cookie.setMaxAge(0);
cookie.setPath(_getCookiePath(externalContext));
- cookie.setValue(null);
+ //MYFACES-3354 jetty 6.1.5 does not allow this,
+ //call setMaxAge(0) is enough
+ //cookie.setValue(null);
httpResponse.addCookie(cookie);
}
}
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java?rev=1202947&r1=1202946&r2=1202947&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java Thu Nov 17 00:16:48 2011
@@ -339,6 +339,101 @@ public final class RendererUtils
throw ex;
}
}
+
+ public static String getStringFromSubmittedValueOrLocalValueReturnNull(FacesContext facesContext,
+ UIComponent component)
+ {
+ try
+ {
+ if (!(component instanceof ValueHolder))
+ {
+ throw new IllegalArgumentException("Component : "
+ + getPathToComponent(component)
+ + "is not a ValueHolder");
+ }
+
+ if (component instanceof EditableValueHolder)
+ {
+ Object submittedValue = ((EditableValueHolder) component)
+ .getSubmittedValue();
+ if (submittedValue != null)
+ {
+ if (log.isLoggable(Level.FINE))
+ log.fine("returning 1 '" + submittedValue + "'");
+ return submittedValue.toString();
+ }
+ }
+
+ Object value;
+
+ if (component instanceof EditableValueHolder)
+ {
+
+ EditableValueHolder holder = (EditableValueHolder) component;
+
+ if (holder.isLocalValueSet())
+ {
+ value = holder.getLocalValue();
+ }
+ else
+ {
+ value = getValue(component);
+ }
+ }
+ else
+ {
+ value = getValue(component);
+ }
+
+ Converter converter = ((ValueHolder) component).getConverter();
+ if (converter == null && value != null)
+ {
+
+ try
+ {
+ converter = facesContext.getApplication().createConverter(
+ value.getClass());
+ if (log.isLoggable(Level.FINE))
+ log.fine("the created converter is " + converter);
+ }
+ catch (FacesException e)
+ {
+ log.log(Level.SEVERE, "No converter for class "
+ + value.getClass().getName()
+ + " found (component id=" + component.getId()
+ + ").", e);
+ // converter stays null
+ }
+ }
+
+ if (converter == null)
+ {
+ if (value == null)
+ {
+ //if (log.isLoggable(Level.FINE))
+ // log.fine("returning an empty string");
+ return null;
+ }
+
+ if (log.isLoggable(Level.FINE))
+ log.fine("returning an .toString");
+ return value.toString();
+
+ }
+
+ if (log.isLoggable(Level.FINE))
+ log.fine("returning converter get as string " + converter);
+ return converter.getAsString(facesContext, component, value);
+
+ }
+ catch (PropertyNotFoundException ex)
+ {
+ log.log(Level.SEVERE, "Property not found - called by component : "
+ + getPathToComponent(component), ex);
+
+ throw ex;
+ }
+ }
private static Object getValue(UIComponent component) {
Object value;
@@ -516,18 +611,25 @@ public final class RendererUtils
public static void renderChildren(FacesContext facesContext, UIComponent component)
throws IOException
{
- int childCount = component.getChildCount();
- if (childCount > 0)
+ if (component.getChildCount() > 0)
{
- for (int i = 0; i < childCount; i++)
+ for (int i = 0; i < component.getChildCount(); i++)
{
UIComponent child = component.getChildren().get(i);
- renderChild(facesContext, child);
+ //renderChild(facesContext, child);
+ child.encodeAll(facesContext);
}
}
}
-
+ /**
+ *
+ * @param facesContext
+ * @param child
+ * @throws IOException
+ * @deprecated use UIComponent.encodeAll() instead
+ */
+ @Deprecated
public static void renderChild(FacesContext facesContext, UIComponent child)
throws IOException
{
@@ -642,7 +744,7 @@ public final class RendererUtils
converter = new PassThroughAsStringConverter(converter);
}
- return internalSubmittedOrSelectedValuesAsSet(context, component, converter, uiSelectMany, submittedValues);
+ return internalSubmittedOrSelectedValuesAsSet(context, component, converter, uiSelectMany, submittedValues, false);
}
@@ -659,7 +761,7 @@ public final class RendererUtils
{
Object selectedValues = uiSelectMany.getValue();
- return internalSubmittedOrSelectedValuesAsSet(context, component, converter, uiSelectMany, selectedValues);
+ return internalSubmittedOrSelectedValuesAsSet(context, component, converter, uiSelectMany, selectedValues, true);
}
@@ -694,10 +796,9 @@ public final class RendererUtils
return getConvertedStringValue(context, component, converter, selectItem.getValue());
}
-
private static Set internalSubmittedOrSelectedValuesAsSet(FacesContext context,
UIComponent component, Converter converter, UISelectMany uiSelectMany,
- Object values)
+ Object values, boolean allowNonArrayOrCollectionValue)
{
if (values == null || EMPTY_STRING.equals(values))
{
@@ -745,6 +846,12 @@ public final class RendererUtils
return set;
}
+ else if (allowNonArrayOrCollectionValue)
+ {
+ HashSet set = new HashSet(HashMapUtils.calcCapacity(1));
+ set.add(values);
+ return set;
+ }
else
{
throw new IllegalArgumentException("Value of UISelectMany component with path : "
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyConstants.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyConstants.java?rev=1202947&r1=1202946&r2=1202947&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyConstants.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyConstants.java Thu Nov 17 00:16:48 2011
@@ -104,7 +104,7 @@ public class CommonPropertyConstants
public static final long MAXLENGTH_PROP = 0x2000000000L;
public static final long SIZE_PROP = 0x4000000000L;
- public static Map<String, Long> COMMON_PROPERTIES_KEY_BY_NAME = new HashMap<String, Long>(64,1);
+ public static final Map<String, Long> COMMON_PROPERTIES_KEY_BY_NAME = new HashMap<String, Long>(64,1);
static
{
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlBodyRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlBodyRendererBase.java?rev=1202947&r1=1202946&r2=1202947&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlBodyRendererBase.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlBodyRendererBase.java Thu Nov 17 00:16:48 2011
@@ -61,7 +61,8 @@ public class HtmlBodyRendererBase extend
ResponseWriter writer = facesContext.getResponseWriter();
Map<String, List<ClientBehavior>> behaviors = null;
- if (component instanceof ClientBehaviorHolder && JavascriptUtils.isJavascriptAllowed(facesContext.getExternalContext()))
+ if (component instanceof ClientBehaviorHolder &&
+ JavascriptUtils.isJavascriptAllowed(facesContext.getExternalContext()))
{
behaviors = ((ClientBehaviorHolder) component).getClientBehaviors();
if (!behaviors.isEmpty())
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java?rev=1202947&r1=1202946&r2=1202947&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java Thu Nov 17 00:16:48 2011
@@ -19,7 +19,6 @@
package org.apache.myfaces.shared.renderkit.html;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -64,14 +63,16 @@ public class HtmlButtonRendererBase
public void decode(FacesContext facesContext, UIComponent uiComponent)
{
- org.apache.myfaces.shared.renderkit.RendererUtils.checkParamValidity(facesContext, uiComponent, UICommand.class);
+ org.apache.myfaces.shared.renderkit.RendererUtils.checkParamValidity(
+ facesContext, uiComponent, UICommand.class);
//super.decode must not be called, because value is handled here
if (!isReset(uiComponent) && isSubmitted(facesContext, uiComponent))
{
uiComponent.queueEvent(new ActionEvent(uiComponent));
- org.apache.myfaces.shared.renderkit.RendererUtils.initPartialValidationAndModelUpdate(uiComponent, facesContext);
+ org.apache.myfaces.shared.renderkit.RendererUtils.initPartialValidationAndModelUpdate(
+ uiComponent, facesContext);
}
if (uiComponent instanceof ClientBehaviorHolder &&
@@ -112,7 +113,8 @@ public class HtmlButtonRendererBase
public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
throws IOException
{
- org.apache.myfaces.shared.renderkit.RendererUtils.checkParamValidity(facesContext, uiComponent, UICommand.class);
+ org.apache.myfaces.shared.renderkit.RendererUtils.checkParamValidity(
+ facesContext, uiComponent, UICommand.class);
String clientId = uiComponent.getClientId(facesContext);
@@ -167,7 +169,8 @@ public class HtmlButtonRendererBase
String image = RendererUtils.getIconSrc(facesContext, uiComponent, JSFAttr.IMAGE_ATTR);
if (image != null)
{
- writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_IMAGE, org.apache.myfaces.shared.renderkit.JSFAttr.TYPE_ATTR);
+ writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_IMAGE,
+ org.apache.myfaces.shared.renderkit.JSFAttr.TYPE_ATTR);
writer.writeURIAttribute(HTML.SRC_ATTR, image, org.apache.myfaces.shared.renderkit.JSFAttr.IMAGE_ATTR);
}
else
@@ -182,7 +185,8 @@ public class HtmlButtonRendererBase
Object value = getValue(uiComponent);
if (value != null)
{
- writer.writeAttribute(org.apache.myfaces.shared.renderkit.html.HTML.VALUE_ATTR, value, org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR);
+ writer.writeAttribute(org.apache.myfaces.shared.renderkit.html.HTML.VALUE_ATTR, value,
+ org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR);
}
}
@@ -192,7 +196,8 @@ public class HtmlButtonRendererBase
{
if (!reset && !button)
{
- String onClick = buildBehaviorizedOnClick(uiComponent, behaviors, facesContext, writer, formInfo, validParams);
+ String onClick = buildBehaviorizedOnClick(
+ uiComponent, behaviors, facesContext, writer, formInfo, validParams);
if (onClick.length() != 0)
{
writer.writeAttribute(HTML.ONCLICK_ATTR, onClick.toString(), null);
@@ -200,7 +205,8 @@ public class HtmlButtonRendererBase
}
else
{
- Collection<ClientBehaviorContext.Parameter> paramList = HtmlRendererUtils.getClientBehaviorContextParameters(
+ Collection<ClientBehaviorContext.Parameter> paramList =
+ HtmlRendererUtils.getClientBehaviorContextParameters(
HtmlRendererUtils.mapAttachedParamsToStringValues(facesContext, uiComponent));
String onClick = HtmlRendererUtils.buildBehaviorChain(facesContext, uiComponent,
@@ -252,7 +258,8 @@ public class HtmlButtonRendererBase
if (behaviors != null && !behaviors.isEmpty())
{
- HtmlRendererUtils.renderBehaviorizedEventHandlersWithoutOnclick(facesContext, writer, uiComponent, behaviors);
+ HtmlRendererUtils.renderBehaviorizedEventHandlersWithoutOnclick(
+ facesContext, writer, uiComponent, behaviors);
HtmlRendererUtils.renderBehaviorizedFieldEventHandlers(facesContext, writer, uiComponent, behaviors);
}
else
@@ -274,19 +281,22 @@ public class HtmlButtonRendererBase
if (isDisabled(facesContext, uiComponent))
{
- writer.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE, org.apache.myfaces.shared.renderkit.JSFAttr.DISABLED_ATTR);
+ writer.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE,
+ org.apache.myfaces.shared.renderkit.JSFAttr.DISABLED_ATTR);
}
if (isReadonly(facesContext, uiComponent))
{
- writer.writeAttribute(HTML.READONLY_ATTR, Boolean.TRUE, org.apache.myfaces.shared.renderkit.JSFAttr.READONLY_ATTR);
+ writer.writeAttribute(HTML.READONLY_ATTR, Boolean.TRUE,
+ org.apache.myfaces.shared.renderkit.JSFAttr.READONLY_ATTR);
}
writer.endElement(HTML.INPUT_ELEM);
if (formInfo != null)
{
- HtmlFormRendererBase.renderScrollHiddenInputIfNecessary(formInfo.getForm(), facesContext, writer);
+ HtmlFormRendererBase.renderScrollHiddenInputIfNecessary(
+ formInfo.getForm(), facesContext, writer);
}
// render the UIParameter children of the commandButton (since 2.0)
@@ -305,9 +315,12 @@ public class HtmlButtonRendererBase
private boolean hasSubmittingBehavior(Map<String, List<ClientBehavior>> clientBehaviors, String eventName)
{
List<ClientBehavior> eventBehaviors = clientBehaviors.get(eventName);
- if (eventBehaviors != null && !eventBehaviors.isEmpty()) {
- for (ClientBehavior behavior : eventBehaviors) {
- if (behavior.getHints().contains(ClientBehaviorHint.SUBMITTING)) {
+ if (eventBehaviors != null && !eventBehaviors.isEmpty())
+ {
+ for (ClientBehavior behavior : eventBehaviors)
+ {
+ if (behavior.getHints().contains(ClientBehaviorHint.SUBMITTING))
+ {
return true;
}
}
@@ -316,15 +329,18 @@ public class HtmlButtonRendererBase
}
protected String buildBehaviorizedOnClick(UIComponent uiComponent, Map<String, List<ClientBehavior>> behaviors,
- FacesContext facesContext, ResponseWriter writer, FormInfo nestedFormInfo, List<UIParameter> validParams)
+ FacesContext facesContext, ResponseWriter writer,
+ FormInfo nestedFormInfo, List<UIParameter> validParams)
throws IOException
{
- //we can omit autoscroll here for now maybe we should check if it is an ajax behavior and omit it only in this case
+ //we can omit autoscroll here for now maybe we should check if it is an ajax
+ //behavior and omit it only in this case
StringBuilder userOnClick = new StringBuilder();
//user onclick part
String commandOnClick = (String) uiComponent.getAttributes().get(HTML.ONCLICK_ATTR);
- if (commandOnClick != null) {
+ if (commandOnClick != null)
+ {
userOnClick.append(commandOnClick);
userOnClick.append(';');
}
@@ -333,22 +349,31 @@ public class HtmlButtonRendererBase
if (nestedFormInfo != null)
{
- if (validParams != null && !validParams.isEmpty() )
- {
- rendererOnClick.append(buildServerOnclick(facesContext, uiComponent, uiComponent.getClientId(facesContext), nestedFormInfo, validParams));
- }
- else
- {
+ // There is no clean way to detect if a "submit" behavior has been added to the component,
+ // so to keep things simple, if the button is submit type, it is responsibility of the
+ // developer to add a client behavior that submit the form, for example using a f:ajax tag.
+ // Otherwise, there will be a situation where a full submit could be trigger after an ajax
+ // operation. Note we still need to append two scripts if necessary: autoscroll and clear
+ // hidden fields, because this code is called for a submit button.
+ //if (behaviors.isEmpty() && validParams != null && !validParams.isEmpty() )
+ //{
+ // rendererOnClick.append(buildServerOnclick(facesContext, uiComponent,
+ // uiComponent.getClientId(facesContext), nestedFormInfo, validParams));
+ //}
+ //else
+ //{
String formName = nestedFormInfo.getFormName();
- if (JavascriptUtils.isRenderClearJavascriptOnButton(facesContext.getExternalContext())) {
+ if (JavascriptUtils.isRenderClearJavascriptOnButton(facesContext.getExternalContext()))
+ {
//call the script to clear the form (clearFormHiddenParams_<formName>) method
HtmlRendererUtils.appendClearHiddenCommandFormParamsFunctionCall(rendererOnClick, formName);
}
- if (MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isAutoScroll()) {
+ if (MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isAutoScroll())
+ {
HtmlRendererUtils.appendAutoScrollAssignment(rendererOnClick, formName);
}
- }
+ //}
}
//according to the specification in jsf.util.chain jdocs and the spec document we have to use
@@ -369,14 +394,16 @@ public class HtmlButtonRendererBase
StringBuffer onClick = new StringBuffer();
- if (RendererUtils.isAdfOrTrinidadForm(formInfo.getForm())) {
+ if (RendererUtils.isAdfOrTrinidadForm(formInfo.getForm()))
+ {
onClick.append("submitForm('");
onClick.append(formInfo.getForm().getClientId(facesContext));
onClick.append("',1,{source:'");
onClick.append(component.getClientId(facesContext));
onClick.append("'});return false;");
}
- else {
+ else
+ {
StringBuffer params = addChildParameters(facesContext, component, nestingForm, validParams);
String target = getTarget(component);
@@ -396,7 +423,8 @@ public class HtmlButtonRendererBase
append(component.getClientId(facesContext)).append("'");
}
- if (params.length() > 2 || target != null) {
+ if (params.length() > 2 || target != null)
+ {
onClick.append(",").
append(target == null ? "null" : ("'" + target + "'")).append(",").
append(params);
@@ -412,7 +440,9 @@ public class HtmlButtonRendererBase
return onClick.toString();
}
- private StringBuffer addChildParameters(FacesContext context, UIComponent component, UIComponent nestingForm, List<UIParameter> validParams) {
+ private StringBuffer addChildParameters(FacesContext context, UIComponent component,
+ UIComponent nestingForm, List<UIParameter> validParams)
+ {
//add child parameters
StringBuffer params = new StringBuffer();
params.append("[");
@@ -483,13 +513,16 @@ public class HtmlButtonRendererBase
return params;
}
- private String getTarget(UIComponent component) {
+ private String getTarget(UIComponent component)
+ {
// for performance reason: double check for the target attribute
String target;
- if (component instanceof HtmlCommandLink) {
+ if (component instanceof HtmlCommandLink)
+ {
target = ((HtmlCommandLink) component).getTarget();
}
- else {
+ else
+ {
target = (String) component.getAttributes().get(HTML.TARGET_ATTR);
}
return target;
@@ -546,11 +579,13 @@ public class HtmlButtonRendererBase
if (validParams != null && !validParams.isEmpty() )
{
- StringBuffer params = addChildParameters(facesContext, uiComponent, nestedFormInfo.getForm(), validParams);
+ StringBuffer params = addChildParameters(
+ facesContext, uiComponent, nestedFormInfo.getForm(), validParams);
String target = getTarget(uiComponent);
- if (MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isRenderFormSubmitScriptInline())
+ if (MyfacesConfig.getCurrentInstance(
+ facesContext.getExternalContext()).isRenderFormSubmitScriptInline())
{
onClick.append("return ").
append(HtmlRendererUtils.SUBMIT_FORM_FN_NAME).append("('").
@@ -565,7 +600,8 @@ public class HtmlButtonRendererBase
append(uiComponent.getClientId(facesContext)).append("'");
}
- if (params.length() > 2 || target != null) {
+ if (params.length() > 2 || target != null)
+ {
onClick.append(",").
append(target == null ? "null" : ("'" + target + "'")).append(",").
append(params);
@@ -574,7 +610,8 @@ public class HtmlButtonRendererBase
//Not necessary since we are using oamSetHiddenInput to create input hidden fields
//render hidden field - todo: in here for backwards compatibility
- if (MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isRenderHiddenFieldsForLinkParams())
+ if (MyfacesConfig.getCurrentInstance(
+ facesContext.getExternalContext()).isRenderHiddenFieldsForLinkParams())
{
String hiddenFieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(nestedFormInfo);
addHiddenCommandParameter(facesContext, nestedFormInfo.getForm(), hiddenFieldName);
@@ -584,13 +621,15 @@ public class HtmlButtonRendererBase
{
if (JavascriptUtils.isRenderClearJavascriptOnButton(facesContext.getExternalContext()) ||
- MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isRenderHiddenFieldsForLinkParams() )
+ MyfacesConfig.getCurrentInstance(
+ facesContext.getExternalContext()).isRenderHiddenFieldsForLinkParams() )
{
//call the script to clear the form (clearFormHiddenParams_<formName>) method
HtmlRendererUtils.appendClearHiddenCommandFormParamsFunctionCall(onClick, formName);
}
- if (MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isAutoScroll()) {
+ if (MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isAutoScroll())
+ {
HtmlRendererUtils.appendAutoScrollAssignment(onClick, formName);
}
}
@@ -615,7 +654,8 @@ public class HtmlButtonRendererBase
return onClick;
}
- protected void addHiddenCommandParameter(FacesContext facesContext, UIComponent nestingForm, String hiddenFieldName)
+ protected void addHiddenCommandParameter(FacesContext facesContext,
+ UIComponent nestingForm, String hiddenFieldName)
{
if (nestingForm != null)
{
@@ -640,7 +680,8 @@ public class HtmlButtonRendererBase
return ((HtmlCommandButton)uiComponent).isDisabled();
}
- return org.apache.myfaces.shared.renderkit.RendererUtils.getBooleanAttribute(uiComponent, HTML.DISABLED_ATTR, false);
+ return org.apache.myfaces.shared.renderkit.RendererUtils.getBooleanAttribute(
+ uiComponent, HTML.DISABLED_ATTR, false);
}
@@ -650,7 +691,8 @@ public class HtmlButtonRendererBase
{
return ((HtmlCommandButton)uiComponent).isReadonly();
}
- return org.apache.myfaces.shared.renderkit.RendererUtils.getBooleanAttribute(uiComponent, HTML.READONLY_ATTR, false);
+ return org.apache.myfaces.shared.renderkit.RendererUtils.getBooleanAttribute(
+ uiComponent, HTML.READONLY_ATTR, false);
}
private String getImage(UIComponent uiComponent)
Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlGridRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlGridRendererBase.java?rev=1202947&r1=1202946&r2=1202947&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlGridRendererBase.java (original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlGridRendererBase.java Thu Nov 17 00:16:48 2011
@@ -209,7 +209,8 @@ public class HtmlGridRendererBase
writer.writeAttribute(HTML.COLSPAN_ATTR, Integer.toString(columns), null);
HtmlRendererUtils.writePrettyLineSeparator(context);
- RendererUtils.renderChild(context, facet);
+ //RendererUtils.renderChild(context, facet);
+ facet.encodeAll(context);
HtmlRendererUtils.writePrettyLineSeparator(context);
writer.endElement(header ? HTML.TH_ELEM : HTML.TD_ELEM);
@@ -331,7 +332,8 @@ public class HtmlGridRendererBase
writer.writeAttribute(HTML.CLASS_ATTR, columnClassesArray[columnIndex], null);
}
columnIndex = childAttributes(context, writer, child, columnIndex);
- RendererUtils.renderChild(context, child);
+ //RendererUtils.renderChild(context, child);
+ child.encodeAll(context);
writer.endElement(HTML.TD_ELEM);
columnIndex++;