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/16 00:51:37 UTC
svn commit: r1202478 [1/8] - in /myfaces/shared/trunk: ./ 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/java/or...
Author: lu4242
Date: Tue Nov 15 23:51:35 2011
New Revision: 1202478
URL: http://svn.apache.org/viewvc?rev=1202478&view=rev
Log:
synch with impl shared
Added:
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/JavascriptContext.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/MyFacesClassLoader.java
Modified:
myfaces/shared/trunk/core/pom.xml
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/component/EscapeCapable.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/context/flash/SubKeyMap.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/_SharedRendererUtils.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/HtmlBodyRendererBase.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/HtmlCheckboxRendererBase.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlGridRendererBase.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlImageRendererBase.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/HtmlListboxRendererBase.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.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/HtmlMessagesRendererBase.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlOutcomeTargetButtonRendererBase.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRenderer.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/HtmlSecretRendererBase.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/HtmlTextRendererBase.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.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/JavascriptUtils.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/renderkit/html/util/UnicodeEncoder.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/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/ResourceLoaderUtils.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/test/ClassElementHandler.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/Assert.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/BiLevelCacheMap.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/ClassLoaderExtension.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/ClassLoaderUtils.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/ExceptionUtils.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/ExternalContextUtils.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/HashMapUtils.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/LocaleUtils.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/MessageUtils.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/NullEnumeration.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/ParametrizableFacesMessage.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/SelectItemsIterator.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/StateUtils.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/StringUtils.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/WebConfigParamUtils.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/el/ActionsMap.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/el/GenericMap.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/el/StringMap.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/el/TestsMap.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/servlet/SourceCodeServlet.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/xml/MyFacesErrorHandler.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/view/JspViewDeclarationLanguageBase.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/webapp/webxml/WebXml.java
myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/webapp/webxml/WebXmlParser.java
myfaces/shared/trunk/core/src/main/resources/META-INF/myfaces-metadata.xml
myfaces/shared/trunk/pom.xml
Modified: myfaces/shared/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/pom.xml?rev=1202478&r1=1202477&r2=1202478&view=diff
==============================================================================
--- myfaces/shared/trunk/core/pom.xml (original)
+++ myfaces/shared/trunk/core/pom.xml Tue Nov 15 23:51:35 2011
@@ -143,7 +143,7 @@
<profile>
<id>synch-myfaces-impl-shared</id>
<properties>
- <myfaces.impl.shared.version>2.1.2-SNAPSHOT</myfaces.impl.shared.version>
+ <myfaces.impl.shared.version>2.1.4-SNAPSHOT</myfaces.impl.shared.version>
</properties>
<activation>
<property>
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=1202478&r1=1202477&r2=1202478&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 Tue Nov 15 23:51:35 2011
@@ -32,6 +32,7 @@ import javax.faces.context.FacesContext;
import javax.faces.view.ViewDeclarationLanguage;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
+import org.apache.myfaces.shared.util.ExternalContextUtils;
import org.apache.myfaces.shared.util.WebConfigParamUtils;
/**
@@ -55,7 +56,9 @@ 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;
@@ -63,8 +66,12 @@ 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")
- private static final String CHECKED_VIEWID_CACHE_ENABLED_ATTRIBUTE = "org.apache.myfaces.CHECKED_VIEWID_CACHE_ENABLED";
+ @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;
private Map<String, Boolean> _checkedViewIdMap = null;
@@ -85,6 +92,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))
{
@@ -117,6 +134,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);
}
}
@@ -150,6 +177,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)
@@ -164,15 +192,31 @@ 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
@@ -285,7 +329,8 @@ public class DefaultViewHandlerSupport i
protected String[] getFaceletsViewMappings(FacesContext context)
{
- String faceletsViewMappings= context.getExternalContext().getInitParameter(ViewHandler.FACELETS_VIEW_MAPPINGS_PARAM_NAME);
+ String faceletsViewMappings= context.getExternalContext().getInitParameter(
+ ViewHandler.FACELETS_VIEW_MAPPINGS_PARAM_NAME);
if(faceletsViewMappings == null) //consider alias facelets.VIEW_MAPPINGS
{
faceletsViewMappings= context.getExternalContext().getInitParameter("facelets.VIEW_MAPPINGS");
@@ -400,14 +445,18 @@ public class DefaultViewHandlerSupport i
builder.replace(candidateViewId.lastIndexOf('.'), candidateViewId.length(), mapping);
String tempViewId = builder.toString();
if(checkResourceExists(context,tempViewId))
+ {
return tempViewId;
+ }
}
}
}
// forced facelets mappings did not match or there were no entries in faceletsViewMappings array
if(checkResourceExists(context,candidateViewId))
+ {
return candidateViewId;
+ }
}
@@ -439,12 +488,16 @@ public class DefaultViewHandlerSupport i
String candidateViewId = builder.toString();
if(checkResourceExists(context,candidateViewId))
+ {
return candidateViewId;
+ }
}
// Otherwise, if a physical resource exists with the name requestViewId let that value be viewId.
if(checkResourceExists(context,requestViewId))
+ {
return requestViewId;
+ }
//Otherwise return null.
return null;
@@ -460,7 +513,8 @@ public class DefaultViewHandlerSupport i
viewId);
if (resourceExists == null)
{
- ViewDeclarationLanguage vdl = context.getApplication().getViewHandler().getViewDeclarationLanguage(context, viewId);
+ ViewDeclarationLanguage vdl = context.getApplication().getViewHandler()
+ .getViewDeclarationLanguage(context, viewId);
if (vdl != null)
{
resourceExists = vdl.viewExists(context, viewId);
@@ -477,7 +531,8 @@ public class DefaultViewHandlerSupport i
}
else
{
- ViewDeclarationLanguage vdl = context.getApplication().getViewHandler().getViewDeclarationLanguage(context, viewId);
+ ViewDeclarationLanguage vdl = context.getApplication().getViewHandler()
+ .getViewDeclarationLanguage(context, viewId);
if (vdl != null)
{
if (vdl.viewExists(context, viewId))
@@ -506,7 +561,8 @@ public class DefaultViewHandlerSupport i
{
if (_checkedViewIdMap == null)
{
- _checkedViewIdMap = Collections.synchronizedMap(new _CheckedViewIDMap<String, Boolean>(getViewIDCacheMaxSize(context)));
+ _checkedViewIdMap = Collections.synchronizedMap(
+ new _CheckedViewIDMap<String, Boolean>(getViewIDCacheMaxSize(context)));
}
return _checkedViewIdMap;
}
@@ -563,4 +619,4 @@ public class DefaultViewHandlerSupport i
return size() > maxCapacity;
}
}
-}
\ No newline at end of file
+}
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/component/EscapeCapable.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/component/EscapeCapable.java?rev=1202478&r1=1202477&r2=1202478&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/component/EscapeCapable.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/component/EscapeCapable.java Tue Nov 15 23:51:35 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/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=1202478&r1=1202477&r2=1202478&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java Tue Nov 15 23:51:35 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/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=1202478&r1=1202477&r2=1202478&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 Tue Nov 15 23:51:35 2011
@@ -53,10 +53,12 @@ public class FlashImpl extends Flash
// ~ static fields --------------------------------------------------------
- private static final Logger logger = Logger.getLogger(FlashImpl.class.getName());
+ private static final Logger log = 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";
@@ -319,11 +321,11 @@ public class FlashImpl extends Flash
{
if (alreadySet)
{
- logger.warning("Multiple call to setRedirect() ignored.");
+ log.warning("Multiple call to setRedirect() ignored.");
}
else // redirect = false
{
- logger.warning("Ignored call to setRedirect(false), because this "
+ log.warning("Ignored call to setRedirect(false), because this "
+ "should only be set to true by the NavigationHandler. "
+ "No one else should change it.");
}
@@ -628,7 +630,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);
}
}
@@ -797,7 +801,7 @@ public class FlashImpl extends Flash
if (facesContext.isPostback())
{
// on a postback, we should always have a previousToken
- logger.warning("Identifier for execute FlashMap was lost on " +
+ log.warning("Identifier for execute FlashMap was lost on " +
"the postback, thus FlashScope information is gone.");
}
@@ -1060,7 +1064,8 @@ public class FlashImpl extends Flash
*/
private void _checkFlashScopeDisabled()
{
- if (_flashScopeDisabled) {
+ if (_flashScopeDisabled)
+ {
throw new FlashScopeDisabledException("Flash scope was disabled by context param "
+ FLASH_SCOPE_DISABLED_PARAM + " but erroneously accessed");
}
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java?rev=1202478&r1=1202477&r2=1202478&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java Tue Nov 15 23:51:35 2011
@@ -46,9 +46,13 @@ final class SubKeyMap<V> extends Abstrac
public SubKeyMap(Map<String, Object> base, String prefix)
{
if (base == null)
+ {
throw new NullPointerException();
+ }
if (prefix == null)
+ {
throw new NullPointerException();
+ }
// Optimize the scenario where we're wrapping another SubKeyMap
if (base instanceof SubKeyMap)
@@ -94,7 +98,9 @@ final class SubKeyMap<V> extends Abstrac
public boolean containsKey(Object key)
{
if (!(key instanceof String))
+ {
return false;
+ }
return _base.containsKey(_getBaseKey(key));
}
@@ -103,14 +109,18 @@ final class SubKeyMap<V> extends Abstrac
public Set<Map.Entry<String, V>> entrySet()
{
if (_entrySet == null)
+ {
_entrySet = new Entries<V>();
+ }
return _entrySet;
}
private String _getBaseKey(Object key)
{
if (key == null)
+ {
throw new NullPointerException();
+ }
// Yes, I want a ClassCastException if it's not a String
return _prefix + ((String) key);
}
@@ -121,7 +131,9 @@ final class SubKeyMap<V> extends Abstrac
for (String key : _base.keySet())
{
if (key != null && key.startsWith(_prefix))
+ {
list.add(key);
+ }
}
return list;
@@ -154,7 +166,9 @@ final class SubKeyMap<V> extends Abstrac
for (String key : _base.keySet())
{
if (key != null && key.startsWith(_prefix))
+ {
size++;
+ }
}
return size;
@@ -170,7 +184,9 @@ final class SubKeyMap<V> extends Abstrac
// Short-circuit: the default implementation would always
// need to iterate to find the total size.
if (key != null && key.startsWith(_prefix))
+ {
return false;
+ }
}
return true;
@@ -213,7 +229,9 @@ final class SubKeyMap<V> extends Abstrac
public void remove()
{
if (_currentKey == null)
+ {
throw new IllegalStateException();
+ }
_base.remove(_currentKey);
@@ -234,7 +252,9 @@ final class SubKeyMap<V> extends Abstrac
public String getKey()
{
if (_key == null)
+ {
_key = _baseKey.substring(_prefix.length());
+ }
return _key;
}
@@ -253,7 +273,9 @@ final class SubKeyMap<V> extends Abstrac
public boolean equals(Object o)
{
if (!(o instanceof Map.Entry))
+ {
return false;
+ }
Map.Entry<String, V> e = (Map.Entry<String, V>) o;
return _equals(getKey(), e.getKey())
&& _equals(getValue(), e.getValue());
@@ -275,7 +297,9 @@ final class SubKeyMap<V> extends Abstrac
static private boolean _equals(Object a, Object b)
{
if (a == null)
+ {
return b == null;
+ }
return a.equals(b);
}