You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2013/05/12 19:25:40 UTC
svn commit: r1481612 [1/2] - in /myfaces/core/branches/2.1.x-client-window:
./ api/src/main/java/javax/faces/component/
api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/
impl/src/main/java/org/apache/myfaces/application/ impl/src/main/jav...
Author: lu4242
Date: Sun May 12 17:25:39 2013
New Revision: 1481612
URL: http://svn.apache.org/r1481612
Log:
merge revisions 1433542,1448215,1448221,1449029,1449777,1451580,1455392,1461879,1461883,1461890,1461893,1461916,1462113,1467143,1469145,1469329,1470543,1470662,1470740,1470769 from 2.1.x branch
Added:
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/resource/TempDirFileCacheResourceLoader.java
- copied unchanged from r1461879, myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/resource/TempDirFileCacheResourceLoader.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/AbstractFaceletCache.java
- copied unchanged from r1470662, myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/AbstractFaceletCache.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/CacheELFaceletCacheImpl.java
- copied unchanged from r1470662, myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/CacheELFaceletCacheImpl.java
myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/view/facelets/el/CacheELExpressionsAlwaysRecompileTestCase.java
- copied unchanged from r1470662, myfaces/core/branches/2.1.x/impl/src/test/java/org/apache/myfaces/view/facelets/el/CacheELExpressionsAlwaysRecompileTestCase.java
myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/view/facelets/impl/ResourceMarkDeleteTest.java
- copied unchanged from r1461890, myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/view/facelets/impl/ResourceMarkDeleteTest.java
myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/el/includetagtest1.xhtml
- copied unchanged from r1470662, myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/el/includetagtest1.xhtml
myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/el/user.taglib.xml
- copied unchanged from r1470662, myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/el/user.taglib.xml
myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/el/usertagtest1.xhtml
- copied unchanged from r1470662, myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/el/usertagtest1.xhtml
myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/el/usertagtest1_1.xhtml
- copied unchanged from r1470662, myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/el/usertagtest1_1.xhtml
myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/el/usertagtest1_2.xhtml
- copied unchanged from r1470662, myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/el/usertagtest1_2.xhtml
myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/ (props changed)
- copied from r1461890, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/
myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/resources/ (props changed)
- copied from r1461890, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/resources/
myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/resources/js/ (props changed)
- copied from r1461890, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/resources/js/
myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/resources/js/a.js
- copied unchanged from r1461890, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/resources/js/a.js
myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/resources/js/x.js
- copied unchanged from r1461890, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/resources/js/x.js
myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/test_conditional_include_resources.xhtml
- copied unchanged from r1461890, myfaces/core/trunk/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/test_conditional_include_resources.xhtml
Modified:
myfaces/core/branches/2.1.x-client-window/ (props changed)
myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIComponent.java
myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIComponentBase.java
myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIData.java
myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UISelectOne.java
myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/_ViewAttributeMap.java
myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/DefaultResourceHandlerSupport.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheImpl.java (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/SessionIdGenerator.java (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheFactoryImpl.java (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheUtils.java (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/ELExpressionCacheMode.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletFactory.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/TemplateContext.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/TagLibraryConfig.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UILeaf.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/el/DefaultVariableMapper.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheFactoryImpl.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/TemplateContextImpl.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
myfaces/core/branches/2.1.x-client-window/impl/src/main/resources/META-INF/faces-config20.vm (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheTest.java (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheTest.java (props changed)
myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java
myfaces/core/branches/2.1.x-client-window/parent/pom.xml (contents, props changed)
myfaces/core/branches/2.1.x-client-window/parent/src/ (props changed)
myfaces/core/branches/2.1.x-client-window/pom.xml
myfaces/core/branches/2.1.x-client-window/shared/ (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/pom.xml (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/ (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/AttachedDeltaWrapper.java (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/ComponentUtils.java (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/DebugUtils.java (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/RendererUtils.java (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/TagUtils.java (props changed)
myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/renderkit/ (props changed)
myfaces/core/branches/2.1.x-client-window/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlBodyRendererBase.java
myfaces/core/branches/2.1.x-client-window/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java
myfaces/core/branches/2.1.x-client-window/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java
myfaces/core/branches/2.1.x-client-window/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/util/ResourceUtils.java
Propchange: myfaces/core/branches/2.1.x-client-window/
------------------------------------------------------------------------------
Merged /myfaces/core/trunk:r1433542,1448215,1448221,1449029,1449777,1451580,1455392,1461879,1461883,1461890,1461893,1461916,1462113,1467143
Merged /myfaces/core/branches/2.1.x:r1469145,1469329,1470543,1470662,1470740,1470769
Modified: myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIComponent.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIComponent.java (original)
+++ myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIComponent.java Sun May 12 17:25:39 2013
@@ -233,9 +233,23 @@ public abstract class UIComponent
return found;
}
// Searching for this component's children/facets
- for (Iterator<UIComponent> it = this.getFacetsAndChildren(); !found && it.hasNext(); )
+ // [perf] Use getFacetsAndChildren() is nicer but this one prevents
+ // create 1 iterator per component class that does not have
+ // facets attached, which is a common case.
+ if (this.getFacetCount() > 0)
{
- found = it.next().invokeOnComponent(context, clientId, callback);
+ for (Iterator<UIComponent> it = this.getFacets().values().iterator(); !found && it.hasNext(); )
+ {
+ found = it.next().invokeOnComponent(context, clientId, callback);
+ }
+ }
+ if (this.getChildCount() > 0)
+ {
+ for (int i = 0, childCount = getChildCount(); !found && (i < childCount); i++)
+ {
+ UIComponent child = getChildren().get(i);
+ found = child.invokeOnComponent(context, clientId, callback);
+ }
}
return found;
}
Modified: myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIComponentBase.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIComponentBase.java (original)
+++ myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIComponentBase.java Sun May 12 17:25:39 2013
@@ -1149,8 +1149,6 @@ public abstract class UIComponentBase ex
}
}
}
-
-
@Override
public boolean visitTree(VisitContext context, VisitCallback callback)
Modified: myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIData.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIData.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIData.java (original)
+++ myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UIData.java Sun May 12 17:25:39 2013
@@ -423,11 +423,16 @@ public class UIData extends UIComponentB
returnValue = true;
}
// process the child's facets
- for (Iterator<UIComponent> itChildFacets = child.getFacets().values().iterator();
- !returnValue && itChildFacets.hasNext();)
+ if (child.getFacetCount() > 0)
{
- //recursive call to find the component
- returnValue = itChildFacets.next().invokeOnComponent(context, clientId, callback);
+ for (Iterator<UIComponent> itChildFacets =
+ child.getFacets().values().iterator();
+ !returnValue && itChildFacets.hasNext();)
+ {
+ //recursive call to find the component
+ returnValue = itChildFacets.next().invokeOnComponent(
+ context, clientId, callback);
+ }
}
}
}
@@ -2190,11 +2195,14 @@ public class UIData extends UIComponentB
{
return true;
}
- for (UIComponent facet : child.getFacets().values())
+ if (child.getFacetCount() > 0)
{
- if (facet.visitTree(context, callback))
+ for (UIComponent facet : child.getFacets().values())
{
- return true;
+ if (facet.visitTree(context, callback))
+ {
+ return true;
+ }
}
}
}
Modified: myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UISelectOne.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UISelectOne.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UISelectOne.java (original)
+++ myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/UISelectOne.java Sun May 12 17:25:39 2013
@@ -18,8 +18,12 @@
*/
package javax.faces.component;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
+import javax.faces.model.SelectItem;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFJspProperty;
@@ -75,14 +79,21 @@ public class UISelectOne extends UIInput
// and if required is true it must not match an option with noSelectionOption set to true (since 2.0)
Converter converter = getConverter();
- if (_SelectItemsUtil.matchValue(context, this, value, new _SelectItemsIterator(this, context), converter))
+ // Since the iterator is used twice, it has sense to traverse it only once.
+ Collection<SelectItem> items = new ArrayList<SelectItem>();
+ for (Iterator<SelectItem> iter = new _SelectItemsIterator(this, context); iter.hasNext();)
+ {
+ items.add(iter.next());
+ }
+
+ if (_SelectItemsUtil.matchValue(context, this, value, items.iterator(), converter))
{
if (! this.isRequired())
{
return; // Matched & Required false, so return ok.
}
if (! _SelectItemsUtil.isNoSelectionOption(context, this, value,
- new _SelectItemsIterator(this, context), converter))
+ items.iterator(), converter))
{
return; // Matched & Required true & No-selection did NOT match, so return ok.
}
Modified: myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/_ViewAttributeMap.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/_ViewAttributeMap.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/_ViewAttributeMap.java (original)
+++ myfaces/core/branches/2.1.x-client-window/api/src/main/java/javax/faces/component/_ViewAttributeMap.java Sun May 12 17:25:39 2013
@@ -18,6 +18,7 @@
*/
package javax.faces.component;
+import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
@@ -27,8 +28,10 @@ import java.util.Set;
*
* @author Leonardo Uribe
*/
-class _ViewAttributeMap implements Map<String, Object>
+class _ViewAttributeMap implements Map<String, Object>, Serializable
{
+ private static final long serialVersionUID = -9106832109394257866L;
+
//private static final String RESET_SAVE_STATE_MODE_KEY =
// "oam.view.resetSaveStateMode";
Modified: myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js (original)
+++ myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Dom.js Sun May 12 17:25:39 2013
@@ -1026,7 +1026,16 @@ _MF_SINGLTN(_PFX_UTIL + "_Dom", Object,
if (!node.setAttribute) {
return;
}
- node.setAttribute(attr, val);
+
+ if (attr === 'disabled') {
+ node.disabled = val === 'disabled' || val === 'true';
+ } else if (attr === 'checked') {
+ node.checked = val === 'checked' || val === 'on' || val === 'true';
+ } else if (attr == 'readonly') {
+ node.readOnly = val === 'readonly' || val === 'true';
+ } else {
+ node.setAttribute(attr, val);
+ }
},
/**
Modified: myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js (original)
+++ myfaces/core/branches/2.1.x-client-window/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomQuirks.js Sun May 12 17:25:39 2013
@@ -468,12 +468,13 @@ if (_MF_SINGLTN) {
//ie supported events
if (this.IE_QUIRKS_EVENTS[attr]) {
if (this._Lang.isString(attr)) {
- //event resolves to window.event in ie
- var _t = this;
- node.setAttribute(attr, function () {
- //event implicitly used
- return _t._Lang.globalEval(val);
- });
+ var c = document.body.appendChild(document.createElement('span'));
+ try {
+ c.innerHTML = '<span ' + attr + '="' + val + '"/>';
+ node[attr] = c.firstChild[attr];
+ } finally {
+ document.body.removeChild(c);
+ }
}
} else {
//unknown cases we try to catch them via standard setAttributes
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/DefaultResourceHandlerSupport.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/DefaultResourceHandlerSupport.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/DefaultResourceHandlerSupport.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/DefaultResourceHandlerSupport.java Sun May 12 17:25:39 2013
@@ -22,6 +22,7 @@ import javax.faces.application.ProjectSt
import javax.faces.context.FacesContext;
import org.apache.myfaces.resource.InternalClassLoaderResourceLoader;
+import org.apache.myfaces.resource.TempDirFileCacheResourceLoader;
import org.apache.myfaces.shared.renderkit.html.util.ResourceUtils;
import org.apache.myfaces.shared.resource.BaseResourceHandlerSupport;
import org.apache.myfaces.shared.resource.ClassLoaderResourceLoader;
@@ -55,27 +56,57 @@ public class DefaultResourceHandlerSuppo
if (_resourceLoaders == null)
{
FacesContext facesContext = FacesContext.getCurrentInstance();
- //The ExternalContextResourceLoader has precedence over
- //ClassLoaderResourceLoader, so it goes first.
- String renderedJSFJS = WebConfigParamUtils.getStringInitParameter(facesContext.getExternalContext(),
- InternalClassLoaderResourceLoader.MYFACES_JSF_MODE,
- ResourceUtils.JSF_MYFACES_JSFJS_NORMAL);
-
- if (facesContext.isProjectStage(ProjectStage.Development) ||
- !renderedJSFJS.equals(ResourceUtils.JSF_MYFACES_JSFJS_NORMAL))
+
+ if (TempDirFileCacheResourceLoader.isValidCreateTemporalFiles(facesContext))
{
- _resourceLoaders = new ResourceLoader[] {
- new ExternalContextResourceLoader(RESOURCES),
- new InternalClassLoaderResourceLoader(META_INF_INTERNAL_RESOURCES),
- new ClassLoaderResourceLoader(META_INF_RESOURCES)
- };
+ //The ExternalContextResourceLoader has precedence over
+ //ClassLoaderResourceLoader, so it goes first.
+ String renderedJSFJS = WebConfigParamUtils.getStringInitParameter(facesContext.getExternalContext(),
+ InternalClassLoaderResourceLoader.MYFACES_JSF_MODE,
+ ResourceUtils.JSF_MYFACES_JSFJS_NORMAL);
+
+ if (facesContext.isProjectStage(ProjectStage.Development) ||
+ !renderedJSFJS.equals(ResourceUtils.JSF_MYFACES_JSFJS_NORMAL))
+ {
+ _resourceLoaders = new ResourceLoader[] {
+ new TempDirFileCacheResourceLoader(new ExternalContextResourceLoader(RESOURCES)),
+ new TempDirFileCacheResourceLoader(
+ new InternalClassLoaderResourceLoader(META_INF_INTERNAL_RESOURCES)),
+ new TempDirFileCacheResourceLoader(new ClassLoaderResourceLoader(META_INF_RESOURCES))
+ };
+ }
+ else
+ {
+ _resourceLoaders = new ResourceLoader[] {
+ new TempDirFileCacheResourceLoader(new ExternalContextResourceLoader(RESOURCES)),
+ new TempDirFileCacheResourceLoader(new ClassLoaderResourceLoader(META_INF_RESOURCES))
+ };
+ }
}
else
- {
- _resourceLoaders = new ResourceLoader[] {
- new ExternalContextResourceLoader(RESOURCES),
- new ClassLoaderResourceLoader(META_INF_RESOURCES)
- };
+ {
+ //The ExternalContextResourceLoader has precedence over
+ //ClassLoaderResourceLoader, so it goes first.
+ String renderedJSFJS = WebConfigParamUtils.getStringInitParameter(facesContext.getExternalContext(),
+ InternalClassLoaderResourceLoader.MYFACES_JSF_MODE,
+ ResourceUtils.JSF_MYFACES_JSFJS_NORMAL);
+
+ if (facesContext.isProjectStage(ProjectStage.Development) ||
+ !renderedJSFJS.equals(ResourceUtils.JSF_MYFACES_JSFJS_NORMAL))
+ {
+ _resourceLoaders = new ResourceLoader[] {
+ new ExternalContextResourceLoader(RESOURCES),
+ new InternalClassLoaderResourceLoader(META_INF_INTERNAL_RESOURCES),
+ new ClassLoaderResourceLoader(META_INF_RESOURCES)
+ };
+ }
+ else
+ {
+ _resourceLoaders = new ResourceLoader[] {
+ new ExternalContextResourceLoader(RESOURCES),
+ new ClassLoaderResourceLoader(META_INF_RESOURCES)
+ };
+ }
}
}
return _resourceLoaders;
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/ResourceHandlerImpl.java Sun May 12 17:25:39 2013
@@ -83,10 +83,12 @@ public class ResourceHandlerImpl extends
*/
@JSFWebConfigParam(since="2.1.10, 2.0.16", defaultValue="2048", group="resources")
public static final String INIT_PARAM_RESOURCE_BUFFER_SIZE = "org.apache.myfaces.RESOURCE_BUFFER_SIZE";
- private static final int INIT_PARAM_RESOURCE_BUFFER_SIZE_DEFAULT = 2048;
+ public static final int INIT_PARAM_RESOURCE_BUFFER_SIZE_DEFAULT = 2048;
private Boolean _allowSlashLibraryName;
private int _resourceBufferSize = -1;
+
+ private String[] _excludedResourceExtensions;
@Override
public Resource createResource(String resourceName)
@@ -403,7 +405,10 @@ public class ResourceHandlerImpl extends
{
int count = pipeBytes(in, out, buffer);
//set the content lenght
- httpServletResponse.setContentLength(count);
+ if (!httpServletResponse.isCommitted())
+ {
+ httpServletResponse.setContentLength(count);
+ }
}
finally
{
@@ -542,20 +547,20 @@ public class ResourceHandlerImpl extends
return localePrefix;
}
- protected boolean isResourceIdentifierExcluded(FacesContext context,
- String resourceIdentifier)
+ protected boolean isResourceIdentifierExcluded(FacesContext context, String resourceIdentifier)
{
- String value = context.getExternalContext().getInitParameter(
- RESOURCE_EXCLUDES_PARAM_NAME);
- if (value == null)
+ if (_excludedResourceExtensions == null)
{
- value = RESOURCE_EXCLUDES_DEFAULT_VALUE;
+ String value = WebConfigParamUtils.getStringInitParameter(context.getExternalContext(),
+ RESOURCE_EXCLUDES_PARAM_NAME,
+ RESOURCE_EXCLUDES_DEFAULT_VALUE);
+
+ _excludedResourceExtensions = StringUtils.splitShortString(value, ' ');
}
- //TODO: optimize this code
- String[] extensions = StringUtils.splitShortString(value, ' ');
- for (int i = 0; i < extensions.length; i++)
+
+ for (int i = 0; i < _excludedResourceExtensions.length; i++)
{
- if (resourceIdentifier.endsWith(extensions[i]))
+ if (resourceIdentifier.endsWith(_excludedResourceExtensions[i]))
{
return true;
}
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/TreeStructureManager.java Sun May 12 17:25:39 2013
@@ -73,9 +73,10 @@ public class TreeStructureManager
}
//facets
- Map<String, UIComponent> facetMap = component.getFacets();
- if (!facetMap.isEmpty())
+
+ if (component.getFacetCount() > 0)
{
+ Map<String, UIComponent> facetMap = component.getFacets();
List<Object[]> structFacetList = new ArrayList<Object[]>();
for (Map.Entry<String, UIComponent> entry : facetMap.entrySet())
{
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheImpl.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheImpl.java:r1433542,1448215,1448221,1449029,1449777,1451580,1455392,1461879,1461883,1461890,1461893,1461916,1462113,1467143
Merged /myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheImpl.java:r1469145,1469329,1470543,1470662,1470740,1470769
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java
------------------------------------------------------------------------------
Merged /myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java:r1469145,1469329,1470543,1470662,1470740,1470769
Merged /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheImpl.java:r1433542,1448215,1448221,1449029,1449777,1451580,1455392,1461879,1461883,1461890,1461893,1461916,1462113,1467143
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/SessionIdGenerator.java
------------------------------------------------------------------------------
Merged /myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/application/viewstate/SessionIdGenerator.java:r1469145,1469329,1470543,1470662,1470740,1470769
Merged /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/viewstate/SessionIdGenerator.java:r1433542,1448215,1448221,1449029,1449777,1451580,1455392,1461879,1461883,1461890,1461893,1461916,1462113,1467143
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheFactoryImpl.java
------------------------------------------------------------------------------
Merged /myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheFactoryImpl.java:r1469145,1469329,1470543,1470662,1470740,1470769
Merged /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheFactoryImpl.java:r1433542,1448215,1448221,1449029,1449777,1451580,1455392,1461879,1461883,1461890,1461893,1461916,1462113,1467143
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheUtils.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheUtils.java:r1433542,1448215,1448221,1449029,1449777,1451580,1455392,1461879,1461883,1461890,1461893,1461916,1462113,1467143
Merged /myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/application/viewstate/StateCacheUtils.java:r1469145,1469329,1470543,1470662,1470740,1470769
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java Sun May 12 17:25:39 2013
@@ -225,6 +225,7 @@ public class AnnotationConfigurator
if (renderKit == null)
{
renderKit = new org.apache.myfaces.config.impl.digester.elements.RenderKit();
+ renderKit.setId(renderKitId);
facesConfig.addRenderKit(renderKit);
}
@@ -492,6 +493,7 @@ public class AnnotationConfigurator
if (renderKit == null)
{
renderKit = new org.apache.myfaces.config.impl.digester.elements.RenderKit();
+ renderKit.setId(renderKitId);
facesConfig.addRenderKit(renderKit);
}
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/renderkit/ErrorPageWriter.java Sun May 12 17:25:39 2013
@@ -839,7 +839,7 @@ public final class ErrorPageWriter
}
writer.write(">");
- boolean hasChildren = (c.getChildCount() > 0 || c.getFacets().size() > 0) && writeChildren;
+ boolean hasChildren = (c.getChildCount() > 0 || c.getFacetCount() > 0) && writeChildren;
int stateSize = 0;
@@ -865,7 +865,7 @@ public final class ErrorPageWriter
writer.write("</dt>");
if (hasChildren)
{
- if (c.getFacets().size() > 0)
+ if (c.getFacetCount() > 0)
{
for (Map.Entry<String, UIComponent> entry : c.getFacets().entrySet())
{
@@ -939,7 +939,7 @@ public final class ErrorPageWriter
}
UIComponent parent = target.getParent();
- boolean hasChildren = (target.getChildCount() > 0 || target.getFacets().size() > 0);
+ boolean hasChildren = (target.getChildCount() > 0 || target.getFacetCount() > 0);
String facetName = _getFacetName(target);
if (!(target instanceof UIColumn))
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/util/DebugUtils.java Sun May 12 17:25:39 2013
@@ -298,9 +298,9 @@ public class DebugUtils
if (withChildrenAndFacets)
{
int childCount = comp.getChildCount();
- Map<String, UIComponent> facetsMap = comp.getFacets();
- if (childCount > 0 || !facetsMap.isEmpty())
+ if (childCount > 0 || comp.getFacetCount() > 0)
{
+ Map<String, UIComponent> facetsMap = comp.getFacets();
nestedObjects = true;
if (mustClose)
{
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/ELExpressionCacheMode.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/ELExpressionCacheMode.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/ELExpressionCacheMode.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/ELExpressionCacheMode.java Sun May 12 17:25:39 2013
@@ -52,5 +52,16 @@ public enum ELExpressionCacheMode
* Note if ui:param is used, each template call should define the same
* param count, even if only just a few are used.
*/
- always
+ always,
+
+ /**
+ * Does not cache expressions on these cases:
+ * - An expression uses a variable resolved through VariableMapper
+ *
+ * It uses an alternate FaceletCache that implements AbstractFaceletCache
+ * contract and force recompile the facelet in case additional ui:param
+ * instances are detected.
+ *
+ */
+ alwaysRecompile,
}
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletFactory.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletFactory.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletFactory.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/FaceletFactory.java Sun May 12 17:25:39 2013
@@ -23,6 +23,7 @@ import javax.faces.FacesException;
import javax.faces.view.facelets.FaceletException;
import java.io.IOException;
import java.net.URL;
+import javax.faces.view.facelets.FaceletContext;
/**
* FaceletFactory for producing Facelets relative to the context of the underlying implementation.
@@ -60,6 +61,23 @@ public abstract class FaceletFactory
* @throws ELException
*/
public abstract Facelet getFacelet(URL url) throws IOException, FaceletException, FacesException, ELException;
+
+ /**
+ * Create a Facelet from the passed URL, but take into account the context. This method is
+ * useful in cases where the facelet instance must replace the one in the cache based on
+ * the context, instead take the one from the cache, like for example when the EL expression
+ * cache is used.
+ *
+ * @param url
+ * source url
+ * @return Facelet instance
+ * @throws IOException
+ * @throws FaceletException
+ * @throws FacesException
+ * @throws ELException
+ */
+ public abstract Facelet getFacelet(FaceletContext ctx, URL url)
+ throws IOException, FaceletException, FacesException, ELException;
/**
* Return a Facelet instance as specified by the file at the passed URI. The returned facelet is used
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/TemplateContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/TemplateContext.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/TemplateContext.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/TemplateContext.java Sun May 12 17:25:39 2013
@@ -20,6 +20,7 @@ package org.apache.myfaces.view.facelets
import java.io.IOException;
import java.util.Map;
+import java.util.Set;
import javax.el.ELException;
import javax.el.ValueExpression;
@@ -140,4 +141,43 @@ public abstract class TemplateContext
* @return
*/
public abstract void setAllowCacheELExpressions(boolean cacheELExpressions);
+
+ /**
+ *
+ * @since 2.1.12
+ * @param key
+ * @return
+ */
+ public abstract boolean containsParameter(String key);
+
+ /**
+ * Return a set of the parameters known associated to this template context and/or
+ * template. This logic is used to detect which EL Expressions can be cached or not.
+ *
+ * @since 2.1.12
+ * @return
+ */
+ public abstract Set<String> getKnownParameters();
+
+ /**
+ *
+ * @since 2.1.12
+ * @param key
+ * @return
+ */
+ public abstract boolean containsKnownParameter(String key);
+
+ /**
+ *
+ * @since 2.1.12
+ * @return
+ */
+ public abstract boolean isKnownParametersEmpty();
+
+ /**
+ *
+ * @since 2.1.12
+ * @param knownParameters
+ */
+ public abstract void addKnownParameters(String knownParameters);
}
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/TagLibraryConfig.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/TagLibraryConfig.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/TagLibraryConfig.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/TagLibraryConfig.java Sun May 12 17:25:39 2013
@@ -18,31 +18,6 @@
*/
package org.apache.myfaces.view.facelets.compiler;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Collection;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Pattern;
-
-import javax.faces.FacesException;
-import javax.faces.application.Resource;
-import javax.faces.application.ResourceHandler;
-import javax.faces.application.ViewHandler;
-import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
-import javax.faces.view.facelets.ComponentConfig;
-import javax.faces.view.facelets.FaceletHandler;
-import javax.faces.view.facelets.Tag;
-import javax.faces.view.facelets.TagConfig;
-import javax.faces.view.facelets.TagHandler;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
import org.apache.myfaces.config.ConfigFilesXmlValidationUtils;
import org.apache.myfaces.shared.config.MyfacesConfig;
import org.apache.myfaces.shared.util.ArrayUtils;
@@ -65,6 +40,30 @@ import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
+import javax.faces.FacesException;
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
+import javax.faces.application.ViewHandler;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.FaceletHandler;
+import javax.faces.view.facelets.Tag;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagHandler;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Collection;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.regex.Pattern;
+
/**
* Handles creating a {@link org.apache.myfaces.view.facelets.tag.TagLibrary TagLibrary}
* from a {@link java.net.URL URL} source.
@@ -618,10 +617,8 @@ public final class TagLibraryConfig
}
catch (Exception e)
{
- SAXException saxe = new SAXException("Error Handling [" + this.source + "@"
- + this.locator.getLineNumber() + "," + this.locator.getColumnNumber() + "] <" + qName + ">");
- saxe.initCause(e);
- throw saxe;
+ throw new SAXParseException("Error Handling [" + this.source + "@" + this.locator.getLineNumber()
+ + "," + this.locator.getColumnNumber() + "] <" + qName + ">", locator, e);
}
}
@@ -743,10 +740,8 @@ public final class TagLibraryConfig
public void error(SAXParseException e) throws SAXException
{
- SAXException saxe = new SAXException("Error Handling [" + this.source + "@" + e.getLineNumber() + ","
- + e.getColumnNumber() + "]");
- saxe.initCause(e);
- throw saxe;
+ throw new SAXException(
+ "Error Handling [" + this.source + "@" + e.getLineNumber() + "," + e.getColumnNumber() + "]", e);
}
public void setDocumentLocator(Locator locator)
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UILeaf.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UILeaf.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UILeaf.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/UILeaf.java Sun May 12 17:25:39 2013
@@ -159,11 +159,14 @@ class UILeaf extends UIComponent impleme
@Override
public void setId(String id)
{
- isIdValid(id);
+ // UILeaf instance are just a wrapper for html markup. It never has
+ // an user defined id. The validation check here is just useless,
+ // because facelets algorithm ensures that.
+ //isIdValid(id);
_id = id;
_clientId = null;
}
-
+ /*
private void isIdValid(String string)
{
@@ -205,7 +208,7 @@ class UILeaf extends UIComponent impleme
+ c + "\"");
}
}
- }
+ }*/
private String getComponentLocation(UIComponent component)
{
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/el/DefaultVariableMapper.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/el/DefaultVariableMapper.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/el/DefaultVariableMapper.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/el/DefaultVariableMapper.java Sun May 12 17:25:39 2013
@@ -93,9 +93,10 @@ public final class DefaultVariableMapper
}
}
- if (_templateContext != null && !_templateContext.isParameterEmpty())
+ if (_templateContext != null)
{
- if (_templateContext.getParameterMap().containsKey(name))
+ if (!_templateContext.isParameterEmpty() &&
+ _templateContext.containsParameter(name))
{
returnValue = _templateContext.getParameter(name);
if (_trackResolveVariables)
@@ -104,6 +105,21 @@ public final class DefaultVariableMapper
}
return returnValue;
}
+ else if (!_templateContext.isKnownParametersEmpty() &&
+ _templateContext.containsKnownParameter(name))
+ {
+ // This part is the most important in alwaysRecompile EL cache hack.
+ // The idea is maintain a list of the parameters used in a template,
+ // and if the name to be resolved match one of the list, even if the
+ // param was not set it is necessary to track it as variable resolved.
+ // This will force create a new EL expression each time the view is
+ // built, preserving ui:param and VariableMapper behavior, but allow
+ // cache all expressions that are not related.
+ if (_trackResolveVariables)
+ {
+ _variableResolved = true;
+ }
+ }
}
if (_delegate != null)
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFacelet.java Sun May 12 17:25:39 2013
@@ -462,7 +462,7 @@ final class DefaultFacelet extends Abstr
public void include(AbstractFaceletContext ctx, UIComponent parent, URL url) throws IOException, FacesException,
FaceletException, ELException
{
- DefaultFacelet f = (DefaultFacelet) _factory.getFacelet(url);
+ DefaultFacelet f = (DefaultFacelet) _factory.getFacelet(ctx, url);
f.include(ctx, parent);
}
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletContext.java Sun May 12 17:25:39 2013
@@ -319,17 +319,20 @@ final class DefaultFaceletContext extend
if (uniqueIdFromIterator == null)
{
getFaceletCompositionContext().generateUniqueId(_uniqueIdBuilder);
- _uniqueIdBuilder.append("_");
- _uniqueIdBuilder.append(_prefix);
// Since two different facelets are used to build the metadata, it is necessary
// to trim the "base" part from the returned unique id, to ensure the components will be
// refreshed properly. Note the "base" part is the one that allows to ensure
// uniqueness between two different facelets with the same <f:metadata>, but since by
// spec view metadata sections cannot live on template client facelets, this case is
// just not possible.
+ // MYFACES-3709 It was also noticed that in some cases, the prefix should also
+ // be excluded from the id. The prefix is included if the metadata section is
+ // applied inside an included section (by ui:define and ui:insert for example).
if (!getFaceletCompositionContext().isInMetadataSection())
{
_uniqueIdBuilder.append("_");
+ _uniqueIdBuilder.append(_prefix);
+ _uniqueIdBuilder.append("_");
_uniqueIdBuilder.append(base);
}
uniqueIdFromIterator = _uniqueIdBuilder.toString();
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/DefaultFaceletFactory.java Sun May 12 17:25:39 2013
@@ -34,11 +34,13 @@ import javax.faces.FacesException;
import javax.faces.FactoryFinder;
import javax.faces.view.facelets.FaceletCache;
import javax.faces.view.facelets.FaceletCacheFactory;
+import javax.faces.view.facelets.FaceletContext;
import javax.faces.view.facelets.FaceletException;
import javax.faces.view.facelets.FaceletHandler;
import javax.faces.view.facelets.ResourceResolver;
import org.apache.myfaces.shared.resource.ResourceLoaderUtils;
+import org.apache.myfaces.view.facelets.AbstractFaceletCache;
import org.apache.myfaces.view.facelets.Facelet;
import org.apache.myfaces.view.facelets.FaceletFactory;
import org.apache.myfaces.view.facelets.compiler.Compiler;
@@ -75,6 +77,7 @@ public final class DefaultFaceletFactory
private javax.faces.view.facelets.ResourceResolver _resolver;
private FaceletCache<Facelet> _faceletCache;
+ private AbstractFaceletCache<Facelet> _abstractFaceletCache;
public DefaultFaceletFactory(Compiler compiler, ResourceResolver resolver) throws IOException
{
@@ -122,22 +125,55 @@ public final class DefaultFaceletFactory
}
};
- // Note that FaceletCache.setMemberFactories method is protected, and this is the place where call
- // this method has sense, because DefaultFaceletFactory is the responsible to create Facelet instances.
- // The only way to do it is using reflection, and it has sense, because in this way it is possible to
- // setup a java SecurityManager that prevents call this method (because it is protected, and to do that
- // the code first check for "suppressAccessChecks" permission).
- try
+ if (_faceletCache instanceof AbstractFaceletCache)
{
- Method setMemberFactoriesMethod = FaceletCache.class.getDeclaredMethod("setMemberFactories",
- new Class[]{FaceletCache.MemberFactory.class, FaceletCache.MemberFactory.class});
- setMemberFactoriesMethod.setAccessible(true);
- setMemberFactoriesMethod.invoke(_faceletCache, faceletFactory, viewMetadataFaceletFactory);
- }
- catch (Exception e)
+ _abstractFaceletCache = (AbstractFaceletCache<Facelet>) _faceletCache;
+
+ FaceletCache.MemberFactory<Facelet> compositeComponentMetadataFaceletFactory =
+ new FaceletCache.MemberFactory<Facelet>()
+ {
+ public Facelet newInstance(URL url) throws IOException
+ {
+ return _createCompositeComponentMetadataFacelet(url);
+ }
+ };
+
+ try
+ {
+ Method setMemberFactoriesMethod = AbstractFaceletCache.class.getDeclaredMethod("setMemberFactories",
+ new Class[]{FaceletCache.MemberFactory.class, FaceletCache.MemberFactory.class,
+ FaceletCache.MemberFactory.class});
+ setMemberFactoriesMethod.setAccessible(true);
+ setMemberFactoriesMethod.invoke(_faceletCache, faceletFactory, viewMetadataFaceletFactory,
+ compositeComponentMetadataFaceletFactory);
+ }
+ catch (Exception e)
+ {
+ throw new FacesException(
+ "Cannot call setMemberFactories method, Initialization of FaceletCache failed.",
+ e);
+ }
+ }
+ else
{
- throw new FacesException("Cannot call setMemberFactories method, Initialization of FaceletCache failed.",
- e);
+ // Note that FaceletCache.setMemberFactories method is protected, and this is the place where call
+ // this method has sense, because DefaultFaceletFactory is the responsible to create Facelet instances.
+ // The only way to do it is using reflection, and it has sense, because in this way it is possible to
+ // setup a java SecurityManager that prevents call this method (because it is protected, and to do that
+ // the code first check for "suppressAccessChecks" permission).
+ try
+ {
+ Method setMemberFactoriesMethod = FaceletCache.class.getDeclaredMethod("setMemberFactories",
+ new Class[]{FaceletCache.MemberFactory.class, FaceletCache.MemberFactory.class});
+ setMemberFactoriesMethod.setAccessible(true);
+ setMemberFactoriesMethod.invoke(_faceletCache, faceletFactory, viewMetadataFaceletFactory);
+ }
+ catch (Exception e)
+ {
+ throw new FacesException(
+ "Cannot call setMemberFactories method, Initialization of FaceletCache failed.",
+ e);
+ }
}
if (log.isLoggable(Level.FINE))
@@ -162,6 +198,7 @@ public final class DefaultFaceletFactory
*
* @see org.apache.myfaces.view.facelets.FaceletFactory#getFacelet(java.lang.String)
*/
+ @Override
public Facelet getFacelet(String uri) throws IOException, FaceletException, FacesException, ELException
{
URL url = (URL) _relativeLocations.get(uri);
@@ -194,10 +231,26 @@ public final class DefaultFaceletFactory
* @throws FacesException
* @throws ELException
*/
+ @Override
public Facelet getFacelet(URL url) throws IOException, FaceletException, FacesException, ELException
{
return _faceletCache.getFacelet(url);
}
+
+
+ @Override
+ public Facelet getFacelet(FaceletContext ctx, URL url)
+ throws IOException, FaceletException, FacesException, ELException
+ {
+ if (_abstractFaceletCache != null)
+ {
+ return _abstractFaceletCache.getFacelet(ctx, url);
+ }
+ else
+ {
+ return _faceletCache.getFacelet(url);
+ }
+ }
public long getRefreshPeriod()
{
@@ -408,7 +461,14 @@ public final class DefaultFaceletFactory
public Facelet getViewMetadataFacelet(URL url) throws IOException,
FaceletException, FacesException, ELException
{
- return _faceletCache.getViewMetadataFacelet(url);
+ if (_abstractFaceletCache != null)
+ {
+ return _abstractFaceletCache.getViewMetadataFacelet(url);
+ }
+ else
+ {
+ return _faceletCache.getViewMetadataFacelet(url);
+ }
}
/**
@@ -444,25 +504,31 @@ public final class DefaultFaceletFactory
public Facelet getCompositeComponentMetadataFacelet(URL url) throws IOException,
FaceletException, FacesException, ELException
{
- ParameterCheck.notNull("url", url);
-
- String key = url.toString();
-
- DefaultFacelet f = _compositeComponentMetadataFacelets.get(key);
-
- if (f == null || this.needsToBeRefreshed(f))
+ if (_abstractFaceletCache != null)
{
- f = this._createCompositeComponentMetadataFacelet(url);
- if (_refreshPeriod != NO_CACHE_DELAY)
+ return _abstractFaceletCache.getCompositeComponentMetadataFacelet(url);
+ }
+ else
+ {
+ ParameterCheck.notNull("url", url);
+
+ String key = url.toString();
+
+ DefaultFacelet f = _compositeComponentMetadataFacelets.get(key);
+
+ if (f == null || this.needsToBeRefreshed(f))
{
- Map<String, DefaultFacelet> newLoc
- = new HashMap<String, DefaultFacelet>(_compositeComponentMetadataFacelets);
- newLoc.put(key, f);
- _compositeComponentMetadataFacelets = newLoc;
+ f = this._createCompositeComponentMetadataFacelet(url);
+ if (_refreshPeriod != NO_CACHE_DELAY)
+ {
+ Map<String, DefaultFacelet> newLoc
+ = new HashMap<String, DefaultFacelet>(_compositeComponentMetadataFacelets);
+ newLoc.put(key, f);
+ _compositeComponentMetadataFacelets = newLoc;
+ }
}
+ return f;
}
-
- return f;
}
/**
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheFactoryImpl.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheFactoryImpl.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/FaceletCacheFactoryImpl.java Sun May 12 17:25:39 2013
@@ -25,6 +25,7 @@ import javax.faces.view.facelets.Facelet
import javax.faces.view.facelets.FaceletCacheFactory;
import org.apache.myfaces.shared.util.WebConfigParamUtils;
+import org.apache.myfaces.view.facelets.ELExpressionCacheMode;
import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage;
/**
@@ -59,7 +60,19 @@ public class FaceletCacheFactoryImpl ext
FaceletViewDeclarationLanguage.DEFAULT_REFRESH_PERIOD);
}
- return new FaceletCacheImpl(refreshPeriod);
+ String elMode = WebConfigParamUtils.getStringInitParameter(
+ context.getExternalContext(),
+ FaceletCompositionContextImpl.INIT_PARAM_CACHE_EL_EXPRESSIONS,
+ ELExpressionCacheMode.noCache.name());
+
+ if (ELExpressionCacheMode.alwaysRecompile.toString().equals(elMode))
+ {
+ return new CacheELFaceletCacheImpl(refreshPeriod);
+ }
+ else
+ {
+ return new FaceletCacheImpl(refreshPeriod);
+ }
}
}
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/TemplateContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/TemplateContextImpl.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/TemplateContextImpl.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/impl/TemplateContextImpl.java Sun May 12 17:25:39 2013
@@ -19,12 +19,12 @@
package org.apache.myfaces.view.facelets.impl;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
@@ -63,18 +63,22 @@ public class TemplateContextImpl extends
*/
private static final PageContext INITIAL_PAGE_CONTEXT = new InitialPageContext();
- private final LinkedList<TemplateManagerImpl> _clients;
+ private final List<TemplateManagerImpl> _clients;
private TemplateManager _compositeComponentClient;
private TemplateManagerImpl _lastClient;
private boolean _isCacheELExpressions;
+
+ private final TemplateClientAttributeMap _templateClientAttributeMap;
+
+ private final TemplateClientKnownParameterMap _templateClientKnownParameterMap;
public TemplateContextImpl()
{
super();
- _clients = new LinkedList<TemplateManagerImpl>();
+ _clients = new ArrayList<TemplateManagerImpl>(4);
// Parameters registered using ui:param now are bound to template manager instances, because
// it should follow the same rules as template clients registered here. For example, to resolve
// params on nested ui:decorate and ui:composition the same rules applies than for ui:define and
@@ -82,36 +86,38 @@ public class TemplateContextImpl extends
// page context, so when a new context is added (like in a ui:include), all params registered go
// to this manager.
_clients.add(new TemplateManagerImpl(null, INITIAL_TEMPLATE_CLIENT, true, INITIAL_PAGE_CONTEXT));
- _lastClient = _clients.getFirst();
+ _lastClient = _clients.get(0); //_clients.getFirst();
_isCacheELExpressions = true;
+ _templateClientAttributeMap = new TemplateClientAttributeMap();
+ _templateClientKnownParameterMap = new TemplateClientKnownParameterMap();
}
@Override
public TemplateManager popClient(final AbstractFaceletContext actx)
{
_lastClient = null;
- return _clients.removeFirst();
+ return _clients.remove(0);
}
@Override
public void pushClient(final AbstractFaceletContext actx, final AbstractFacelet owner, final TemplateClient client)
{
- _clients.addFirst(new TemplateManagerImpl(owner, client, true, actx.getPageContext()));
- _lastClient = _clients.getFirst();
+ _clients.add(0, new TemplateManagerImpl(owner, client, true, actx.getPageContext()));
+ _lastClient = _clients.get(0);
}
public TemplateManager popExtendedClient(final AbstractFaceletContext actx)
{
_lastClient = null;
- return _clients.removeLast();
+ return _clients.remove(_clients.size()-1);
}
@Override
public void extendClient(final AbstractFaceletContext actx, final AbstractFacelet owner,
final TemplateClient client)
{
- _clients.addLast(new TemplateManagerImpl(owner, client, false, actx.getPageContext()));
- _lastClient = _clients.getLast();
+ _clients.add(new TemplateManagerImpl(owner, client, false, actx.getPageContext()));
+ _lastClient = _clients.get(_clients.size()-1);
}
@Override
@@ -120,10 +126,9 @@ public class TemplateContextImpl extends
{
boolean found = false;
TemplateManager client;
- Iterator<TemplateManagerImpl> itr = _clients.iterator();
- while (itr.hasNext() && !found)
+ for (int i = 0; i < _clients.size() && !found; i++)
{
- client = itr.next();
+ client = _clients.get(i);
if (client.equals(owner))
{
continue;
@@ -146,6 +151,8 @@ public class TemplateContextImpl extends
private final PageContext _pageContext;
private Map<String, ValueExpression> _parameters = null;
+
+ private Set<String> _knownParameters;
public TemplateManagerImpl(AbstractFacelet owner, TemplateClient target,
boolean root, PageContext pageContext)
@@ -206,11 +213,25 @@ public class TemplateContextImpl extends
return _parameters;
}
- public boolean isParamentersMapEmpty()
+ public boolean isParametersMapEmpty()
{
return _parameters == null ? true : _parameters.isEmpty();
}
+ public Set<String> getKnownParameters()
+ {
+ if (_knownParameters == null)
+ {
+ _knownParameters = new HashSet<String>(4);
+ }
+ return _knownParameters;
+ }
+
+ public boolean isKnownParametersEmpty()
+ {
+ return _knownParameters == null ? true : _knownParameters.isEmpty();
+ }
+
public boolean equals(Object o)
{
if (this._owner != null)
@@ -254,11 +275,10 @@ public class TemplateContextImpl extends
public ValueExpression getParameter(String key)
{
TemplateManagerImpl client;
- Iterator<TemplateManagerImpl> itr = _clients.iterator();
- while (itr.hasNext())
+ for (int i = 0; i < _clients.size(); i++)
{
- client = itr.next();
- if (!client.isParamentersMapEmpty() &&
+ client = _clients.get(i);
+ if (!client.isParametersMapEmpty() &&
client.getParametersMap().containsKey(key))
{
return client.getParametersMap().get(key);
@@ -268,11 +288,28 @@ public class TemplateContextImpl extends
}
@Override
+ public boolean containsParameter(String key)
+ {
+ TemplateManagerImpl client;
+ for (int i = 0; i < _clients.size(); i++)
+ {
+ client = _clients.get(i);
+ if (!client.isParametersMapEmpty() &&
+ client.getParametersMap().containsKey(key))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
public void setParameter(String key, ValueExpression value)
{
if (_lastClient != null)
{
_lastClient.getParametersMap().put(key, value);
+ _lastClient.getKnownParameters().add(key);
}
}
@@ -280,11 +317,10 @@ public class TemplateContextImpl extends
public boolean isParameterEmpty()
{
TemplateManagerImpl client;
- Iterator<TemplateManagerImpl> itr = _clients.iterator();
- while (itr.hasNext())
+ for (int i = 0; i < _clients.size(); i++)
{
- client = itr.next();
- if (!client.isParamentersMapEmpty())
+ client = _clients.get(i);
+ if (!client.isParametersMapEmpty())
{
return false;
}
@@ -294,7 +330,50 @@ public class TemplateContextImpl extends
public Map<String, ValueExpression> getParameterMap()
{
- return new TemplateClientAttributeMap();
+ return _templateClientAttributeMap;
+ }
+
+ public boolean isKnownParametersEmpty()
+ {
+ TemplateManagerImpl client;
+ for (int i = 0; i < _clients.size(); i++)
+ {
+ client = _clients.get(i);
+ if (!client.isKnownParametersEmpty())
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public Set<String> getKnownParameters()
+ {
+ return _templateClientKnownParameterMap.keySet();
+ }
+
+ @Override
+ public boolean containsKnownParameter(String key)
+ {
+ TemplateManagerImpl client;
+ for (int i = 0; i < _clients.size(); i++)
+ {
+ client = _clients.get(i);
+ if (client.getKnownParameters().contains(key))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void addKnownParameters(String key)
+ {
+ if (_lastClient != null)
+ {
+ _lastClient.getKnownParameters().add(key);
+ }
}
private final class TemplateClientAttributeMap extends AbstractAttributeMap<ValueExpression>
@@ -308,11 +387,10 @@ public class TemplateContextImpl extends
protected ValueExpression getAttribute(String key)
{
TemplateManagerImpl client;
- Iterator<TemplateManagerImpl> itr = _clients.iterator();
- while (itr.hasNext())
+ for (int i = 0; i < _clients.size(); i++)
{
- client = itr.next();
- if (!client.isParamentersMapEmpty() &&
+ client = _clients.get(i);
+ if (!client.isParametersMapEmpty() &&
client.getParametersMap().containsKey(key))
{
return client.getParametersMap().get(key);
@@ -324,19 +402,14 @@ public class TemplateContextImpl extends
@Override
protected void setAttribute(String key, ValueExpression value)
{
- if (_lastClient != null)
- {
- _lastClient.getParametersMap().put(key, value);
- }
+ //Use the parent methods.
+ throw new UnsupportedOperationException();
}
@Override
protected void removeAttribute(String key)
{
- if (_lastClient != null)
- {
- _lastClient.getParametersMap().remove(key);
- }
+ throw new UnsupportedOperationException();
}
@Override
@@ -344,11 +417,10 @@ public class TemplateContextImpl extends
{
Set<String> attributeNames = new HashSet<String>();
TemplateManagerImpl client;
- Iterator<TemplateManagerImpl> itr = _clients.iterator();
- while (itr.hasNext())
+ for (int i = 0; i < _clients.size(); i++)
{
- client = itr.next();
- if (!client.isParamentersMapEmpty())
+ client = _clients.get(i);
+ if (!client.isParametersMapEmpty())
{
attributeNames.addAll(client.getParametersMap().keySet());
}
@@ -385,6 +457,59 @@ public class TemplateContextImpl extends
}
}
+ private final class TemplateClientKnownParameterMap extends AbstractAttributeMap<Boolean>
+ {
+
+ public TemplateClientKnownParameterMap()
+ {
+ }
+
+ @Override
+ protected Boolean getAttribute(String key)
+ {
+ TemplateManagerImpl client;
+ for (int i = 0; i < _clients.size(); i++)
+ {
+ client = _clients.get(i);
+ if (!client.isKnownParametersEmpty() &&
+ client.getKnownParameters().contains(key))
+ {
+ return Boolean.TRUE;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected void setAttribute(String key, Boolean value)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected void removeAttribute(String key)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected Enumeration<String> getAttributeNames()
+ {
+ Set<String> attributeNames = new HashSet<String>();
+ TemplateManagerImpl client;
+ for (int i = 0; i < _clients.size(); i++)
+ {
+ client = _clients.get(i);
+ if (!client.isParametersMapEmpty())
+ {
+ attributeNames.addAll(client.getParametersMap().keySet());
+ }
+ }
+
+ return new ParameterNameEnumeration(attributeNames.toArray(new String[attributeNames.size()]));
+ }
+ }
+
/**
* This is just a dummy template client that does nothing that is added by default
* for each template context
@@ -446,5 +571,4 @@ public class TemplateContextImpl extends
_isCacheELExpressions = cacheELExpressions;
}
-
}
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/UserTagHandler.java Sun May 12 17:25:39 2013
@@ -37,6 +37,7 @@ import javax.faces.view.facelets.TagExce
import javax.faces.view.facelets.TagHandler;
import org.apache.myfaces.view.facelets.AbstractFaceletContext;
+import org.apache.myfaces.view.facelets.ELExpressionCacheMode;
import org.apache.myfaces.view.facelets.TemplateClient;
import org.apache.myfaces.view.facelets.TemplateContext;
import org.apache.myfaces.view.facelets.impl.TemplateContextImpl;
@@ -111,6 +112,7 @@ final class UserTagHandler extends TagHa
}
}
actx.pushTemplateContext(new TemplateContextImpl());
+ actx.pushClient(this);
if (this._vars.length > 0)
{
for (int i = 0; i < this._vars.length; i++)
@@ -118,9 +120,12 @@ final class UserTagHandler extends TagHa
((AbstractFaceletContext) ctx).getTemplateContext().setParameter(names[i], values[i]);
}
}
- //Disable caching always, even in 'always' mode
- actx.getTemplateContext().setAllowCacheELExpressions(false);
- actx.pushClient(this);
+ // Disable caching always, even in 'always' mode
+ // The only mode that can support EL caching in this condition is alwaysRedirect.
+ if (!ELExpressionCacheMode.alwaysRecompile.equals(actx.getELExpressionCacheMode()))
+ {
+ actx.getTemplateContext().setAllowCacheELExpressions(false);
+ }
ctx.includeFacelet(parent, this._location);
}
catch (FileNotFoundException e)
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java Sun May 12 17:25:39 2013
@@ -99,9 +99,9 @@ public final class ComponentSupport
}
// remove any facets marked as deleted
- Map<String, UIComponent> facets = component.getFacets();
- if (!facets.isEmpty())
+ if (component.getFacetCount() > 0)
{
+ Map<String, UIComponent> facets = component.getFacets();
Collection<UIComponent> col = facets.values();
for (Iterator<UIComponent> itr = col.iterator(); itr.hasNext();)
{
@@ -346,9 +346,9 @@ public final class ComponentSupport
}
}
- Map<String, UIComponent> facets = component.getFacets();
- if (!facets.isEmpty())
+ if (component.getFacetCount() > 0)
{
+ Map<String, UIComponent> facets = component.getFacets();
for (Iterator<UIComponent> itr = facets.values().iterator(); itr.hasNext();)
{
UIComponent facet = itr.next();
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/main/resources/META-INF/faces-config20.vm
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/impl/src/main/resources/META-INF/faces-config20.vm:r1433542,1448215,1448221,1449029,1449777,1451580,1455392,1461879,1461883,1461890,1461893,1461916,1462113,1467143
Merged /myfaces/core/branches/2.1.x/impl/src/main/resources/META-INF/faces-config20.vm:r1469145,1469329,1470543,1470662,1470740,1470769
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheTest.java
------------------------------------------------------------------------------
Merged /myfaces/core/branches/2.1.x/impl/src/test/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheTest.java:r1469145,1469329,1470543,1470662,1470740,1470769
Merged /myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/viewstate/ClientSideStateCacheTest.java:r1433542,1448215,1448221,1449029,1449777,1451580,1455392,1461879,1461883,1461890,1461893,1461916,1462113,1467143
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheTest.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheTest.java:r1433542,1448215,1448221,1449029,1449777,1451580,1455392,1461879,1461883,1461890,1461893,1461916,1462113,1467143
Merged /myfaces/core/branches/2.1.x/impl/src/test/java/org/apache/myfaces/application/viewstate/ServerSideStateCacheTest.java:r1469145,1469329,1470543,1470662,1470740,1470769
Modified: myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java?rev=1481612&r1=1481611&r2=1481612&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java (original)
+++ myfaces/core/branches/2.1.x-client-window/impl/src/test/java/org/apache/myfaces/view/facelets/tag/ui/IncludeParamTestCase.java Sun May 12 17:25:39 2013
@@ -32,7 +32,9 @@ import org.apache.myfaces.renderkit.html
import org.apache.myfaces.renderkit.html.HtmlCompositeFacetRenderer;
import org.apache.myfaces.renderkit.html.HtmlTextRenderer;
import org.apache.myfaces.test.mock.MockExternalContext;
+import org.apache.myfaces.view.facelets.ELExpressionCacheMode;
import org.apache.myfaces.view.facelets.FaceletTestCase;
+import org.apache.myfaces.view.facelets.impl.FaceletCompositionContextImpl;
import org.apache.myfaces.view.facelets.tag.jsf.ComponentSupport;
import org.apache.myfaces.view.facelets.util.FastWriter;
import org.junit.Assert;
@@ -77,7 +79,7 @@ public class IncludeParamTestCase extend
// handle VariableMapper stuff properly and ui:param logic will not work
return new org.apache.el.ExpressionFactoryImpl();
}
-
+
@Test
public void testCaching() throws Exception
{
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/resources/
------------------------------------------------------------------------------
bugtraq:number = true
Propchange: myfaces/core/branches/2.1.x-client-window/impl/src/test/resources/org/apache/myfaces/view/facelets/impl/resources/js/
------------------------------------------------------------------------------
bugtraq:number = true