From commits-return-69107-archive-asf-public=cust-asf.ponee.io@myfaces.apache.org Tue May 8 14:48:14 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id A755F1807B5 for ; Tue, 8 May 2018 14:48:10 +0200 (CEST) Received: (qmail 4597 invoked by uid 500); 8 May 2018 12:48:09 -0000 Mailing-List: contact commits-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list commits@myfaces.apache.org Received: (qmail 4549 invoked by uid 99); 8 May 2018 12:48:09 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 May 2018 12:48:09 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id CC64F80A64; Tue, 8 May 2018 12:48:08 +0000 (UTC) Date: Tue, 08 May 2018 12:48:11 +0000 To: "commits@myfaces.apache.org" Subject: [myfaces] 08/28: merge latest changes (rev 1383166, 1383168, 1384981, 1384983, 1386916, 1386944, 1389919, 1390212, 1392355, 1393567, 1393891, 1395401, 1395406, 1395409, 1395974, 1397444, 1398700, 1398769, 1398929, 1399817, 1400150, 1401352, 1402825, 1402849, 1403894, 1405217) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: deki@apache.org In-Reply-To: <152578368368.31225.16648429483166825328@gitbox.apache.org> References: <152578368368.31225.16648429483166825328@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: myfaces X-Git-Refname: refs/heads/2.1.x-client-window X-Git-Reftype: branch X-Git-Rev: 8d71d79589541945ed364551a3c1fefe7af16a0c X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20180508124808.CC64F80A64@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. deki pushed a commit to branch 2.1.x-client-window in repository https://gitbox.apache.org/repos/asf/myfaces.git commit 8d71d79589541945ed364551a3c1fefe7af16a0c Merge: d9fa0e1 2bb9f36 Author: Leonardo Uribe AuthorDate: Tue Nov 6 17:29:35 2012 +0000 merge latest changes (rev 1383166,1383168,1384981,1384983,1386916,1386944,1389919,1390212,1392355,1393567,1393891,1395401,1395406,1395409,1395974,1397444,1398700,1398769,1398929,1399817,1400150,1401352,1402825,1402849,1403894,1405217) api/pom.xml | 15 ++ .../java/javax/faces/component/UIComponent.java | 28 ++- .../javax/faces/component/UIComponentBase.java | 36 ++- .../javax/faces/component/UIViewParameter.java | 2 +- .../faces/component/_ComponentAttributesMap.java | 260 ++++++++++++++++----- .../javax/faces/context/PartialResponseWriter.java | 7 + .../myfaces/_impl/_util/_DomExperimental.js | 25 +- .../resources/myfaces/_impl/_util/_ExtLang.js | 15 ++ .../META-INF/resources/myfaces/_impl/core/Impl.js | 12 +- .../resources/myfaces/_impl/core/_EvalHandlers.js | 16 ++ .../resources/myfaces/_impl/core/_RuntimeQuirks.js | 15 ++ .../myfaces/_impl/xhrCore/_AjaxResponse.js | 2 +- .../resources/myfaces/_impl/xhrCore/_Transports.js | 2 +- .../myfaces/_impl/xhrCore/engine/BaseRequest.js | 15 ++ impl/pom.xml | 39 +++- .../.standard-faces-config-base.xml.jsfdia | 18 ++ .../myfaces/application/ViewHandlerImpl.java | 19 +- .../myfaces/config/element/FaceletsProcessing.java | 5 + .../DigesterFacesConfigUnmarshallerImpl.java | 4 + .../impl/digester/elements/FaceletsProcessing.java | 19 ++ .../context/servlet/PartialViewContextImpl.java | 8 +- .../resolver/CompositeComponentELResolver.java | 21 +- .../unified/resolver/ResourceBundleResolver.java | 12 + .../lifecycle/DefaultRestoreViewSupport.java | 27 ++- .../myfaces/lifecycle/RestoreViewExecutor.java | 9 +- .../DefaultFaceletsStateManagementStrategy.java | 5 +- .../view/facelets/compiler/CompilationManager.java | 16 +- .../compiler/FaceletsProcessingInstructions.java | 74 ++++++ .../compiler/LiteralNonExcapedTextInstruction.java | 5 + .../facelets/compiler/LiteralTextInstruction.java | 5 + .../view/facelets/compiler/SAXCompiler.java | 4 +- .../myfaces/view/facelets/compiler/TextUnit.java | 245 ++++++++++++++++++- .../facelets/el/CompositeComponentELUtils.java | 32 +-- .../apache/myfaces/view/facelets/el/ELText.java | 45 +++- .../el/ValueExpressionMethodExpression.java | 45 +++- .../view/facelets/tag/TagAttributeImpl.java | 31 ++- .../tag/composite/CompositeComponentBeanInfo.java | 130 ++++++++++- .../CompositeComponentResourceTagHandler.java | 2 + .../view/facelets/tag/jsf/ComponentSupport.java | 10 +- .../facelets/tag/jsf/core/ViewMetadataHandler.java | 1 + impl/src/main/resources/META-INF/xdoc-component.vm | 13 ++ impl/src/main/resources/META-INF/xdoc-tag.vm | 13 ++ .../src/main/resources/META-INF/xdoc-web-config.vm | 13 ++ .../ClassByteCodeAnnotationFilterTest.java | 18 ++ .../myfaces/lifecycle/RestoreViewExecutorTest.java | 9 +- .../compiler/CompressSpacesTextUnitTestCase.java | 190 +++++++++++++++ .../org/apache/myfaces/lifecycle/view1.jsp | 15 ++ .../org/apache/myfaces/lifecycle/view2.xhtml | 15 ++ .../testSimpleThisResourceReference.xhtml | 15 ++ implee6/pom.xml | 21 +- .../apache/myfaces/shared/application/view1.jsp | 15 ++ .../apache/myfaces/shared/application/view2.xhtml | 15 ++ .../application/DefaultViewHandlerSupport.java | 29 ++- .../renderkit/html/HtmlCheckboxRendererBase.java | 9 +- .../renderkit/html/HtmlRadioRendererBase.java | 9 +- .../renderkit/html/HtmlResponseWriterImpl.java | 124 ++++++++-- .../shared/util/MyFacesObjectInputStream.java | 33 +++ .../apache/myfaces/shared/application/view1.jsp | 15 ++ .../apache/myfaces/shared/application/view2.xhtml | 15 ++ 59 files changed, 1684 insertions(+), 183 deletions(-) diff --cc api/src/main/java/javax/faces/component/UIComponent.java index e2fc65b,e2fc65b..9635c9a --- a/api/src/main/java/javax/faces/component/UIComponent.java +++ b/api/src/main/java/javax/faces/component/UIComponent.java @@@ -445,8 -445,8 +445,20 @@@ public abstract class UIComponen */ public static UIComponent getCurrentComponent(FacesContext context) { ++ Boolean honorCurrentComponentAttributes = null; -- Boolean honorCurrentComponentAttributes = _getHonorCurrentComponentAttributes(context); ++ if (context.getViewRoot() != null) ++ { ++ honorCurrentComponentAttributes = ((UIComponent)context.getViewRoot())._honorCurrentComponentAttributes; ++ if (honorCurrentComponentAttributes == null) ++ { ++ honorCurrentComponentAttributes = _getHonorCurrentComponentAttributes(context); ++ } ++ } ++ else ++ { ++ honorCurrentComponentAttributes = _getHonorCurrentComponentAttributes(context); ++ } if (honorCurrentComponentAttributes == Boolean.TRUE) { @@@ -483,8 -483,8 +495,20 @@@ */ public static UIComponent getCurrentCompositeComponent(FacesContext context) { ++ Boolean honorCurrentComponentAttributes = null; -- Boolean honorCurrentComponentAttributes = _getHonorCurrentComponentAttributes(context); ++ if (context.getViewRoot() != null) ++ { ++ honorCurrentComponentAttributes = ((UIComponent)context.getViewRoot())._honorCurrentComponentAttributes; ++ if (honorCurrentComponentAttributes == null) ++ { ++ honorCurrentComponentAttributes = _getHonorCurrentComponentAttributes(context); ++ } ++ } ++ else ++ { ++ honorCurrentComponentAttributes = _getHonorCurrentComponentAttributes(context); ++ } if (honorCurrentComponentAttributes == Boolean.TRUE) { diff --cc api/src/main/java/javax/faces/component/UIComponentBase.java index 0a0d3eb,0a0d3eb..884e3b3 --- a/api/src/main/java/javax/faces/component/UIComponentBase.java +++ b/api/src/main/java/javax/faces/component/UIComponentBase.java @@@ -103,6 -103,6 +103,8 @@@ public abstract class UIComponentBase e private String _rendererType; private String _markCreated; private String _facetName; ++ private boolean _addedByHandler = false; ++ private boolean _facetCreatedUIPanel = false; /** * This map holds ClientBehavior instances. @@@ -1940,7 -1940,7 +1942,7 @@@ else { //Full -- Object values[] = new Object[9]; ++ Object values[] = new Object[11]; values[0] = saveFacesListenersList(context); StateHelper stateHelper = getStateHelper(false); if (stateHelper != null) @@@ -1954,6 -1954,6 +1956,8 @@@ values[6] = _markCreated; values[7] = _rendererType; values[8] = _isRendererTypeSet; ++ values[9] = _addedByHandler; ++ values[10] = _facetCreatedUIPanel; return values; } @@@ -1989,7 -1989,7 +1993,7 @@@ Object values[] = (Object[]) state; -- if ( values.length == 9 && initialStateMarked()) ++ if ( values.length == 11 && initialStateMarked()) { //Delta mode is active, but we are restoring a full state. //we need to clear the initial state, to restore state without @@@ -2007,7 -2007,7 +2011,7 @@@ ((_AttachedDeltaWrapper) values[0]).getWrappedStateObject()); //} } -- else if (values[0] != null || (values.length == 9)) ++ else if (values[0] != null || (values.length == 11)) { //Full _facesListeners = (_DeltaList) @@@ -2020,13 -2020,13 +2024,15 @@@ getStateHelper().restoreState(context, values[1]); -- if (values.length == 9) ++ if (values.length == 11) { _id = (String) values[4]; _clientId = (String) values[5]; _markCreated = (String) values[6]; _rendererType = (String) values[7]; _isRendererTypeSet = (Boolean) values[8]; ++ _addedByHandler = (Boolean) values[9]; ++ _facetCreatedUIPanel = (Boolean) values[10]; } else if (values.length == 5) { @@@ -2037,7 -2037,7 +2043,7 @@@ // rendererType needs to be restored before SystemEventListener, // otherwise UIComponent.getCurrentComponent(context).getRenderer(context) // will not work correctly -- if (values.length == 9) ++ if (values.length == 11) { //Full restore restoreFullBehaviorsMap(context, values[2]); @@@ -2432,6 -2432,6 +2438,26 @@@ _facetName = facetName; } ++ boolean isOamVfAddedByHandler() ++ { ++ return _addedByHandler; ++ } ++ ++ void setOamVfAddedByHandler(boolean addedByHandler) ++ { ++ _addedByHandler = addedByHandler; ++ } ++ ++ boolean isOamVfFacetCreatedUIPanel() ++ { ++ return _facetCreatedUIPanel; ++ } ++ ++ void setOamVfFacetCreatedUIPanel(boolean facetCreatedUIPanel) ++ { ++ _facetCreatedUIPanel = facetCreatedUIPanel; ++ } ++ /** *

* This gets a single FacesContext-local shared stringbuilder instance, each time you call diff --cc api/src/main/java/javax/faces/component/UIViewParameter.java index 6e2eec2,6e2eec2..399caf9 --- a/api/src/main/java/javax/faces/component/UIViewParameter.java +++ b/api/src/main/java/javax/faces/component/UIViewParameter.java @@@ -103,7 -103,7 +103,7 @@@ public class UIViewParameter extends UI public String getName() { -- return (String) getStateHelper().get(PropertyKeys.name); ++ return (String) getStateHelper().eval(PropertyKeys.name); } public String getStringValue(FacesContext context) diff --cc api/src/main/java/javax/faces/component/_ComponentAttributesMap.java index 7ed41c3,7ed41c3..3a9af0b --- a/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java +++ b/api/src/main/java/javax/faces/component/_ComponentAttributesMap.java @@@ -64,6 -64,6 +64,19 @@@ class _ComponentAttributesMap implement private final static String MARK_CREATED = "oam.vf.MARK_ID"; private final static String FACET_NAME_KEY = "facelets.FACET_NAME"; ++ ++ public final static String FACET_CREATED_UIPANEL_MARKER = "oam.vf.createdUIPanel"; ++ ++ private final static String COMPONENT_ADDED_BY_HANDLER_MARKER = "oam.vf.addedByHandler"; ++ ++ public static final String PROPERTY_DESCRIPTOR_MAP_KEY = "oam.cc.beanInfo.PDM"; ++ ++ /** ++ * This variable works as a check to indicate the minimun lenght we need to check ++ * for the special attributes, and save some time in get(), containsKey() and ++ * put() operations. ++ */ ++ private final static int MIN_LENGHT_CHECK = MARK_CREATED.length(); // The component that is read/written via this map. private UIComponentBase _component; @@@ -85,6 -85,6 +98,8 @@@ private boolean _isCompositeComponent; private boolean _isCompositeComponentSet; ++ ++ private BeanInfo _ccBeanInfo; /** * Create a map backed by the specified component. @@@ -170,32 -170,32 +185,45 @@@ checkKey(key); int keyLength = ((String)key).length(); -- if (MARK_CREATED.length() == keyLength && -- MARK_CREATED.equals(key)) ++ if (keyLength >= MIN_LENGHT_CHECK) { -- return ((UIComponentBase)_component).getOamVfMarkCreated() != null; -- } -- else if (FACET_NAME_KEY.length() == keyLength && -- FACET_NAME_KEY.equals(key)) -- { -- return _component.getOamVfFacetName() != null; -- } -- // The most common call to this method comes from UIComponent.isCompositeComponent() -- // to reduce the impact. This is better than two lookups, once over property descriptor map -- // and the other one from the underlying map. -- if (Resource.COMPONENT_RESOURCE_KEY.length() == keyLength && -- Resource.COMPONENT_RESOURCE_KEY.equals(key)) -- { -- if (!_isCompositeComponentSet) ++ if (MARK_CREATED.length() == keyLength && ++ MARK_CREATED.equals(key)) ++ { ++ return ((UIComponentBase)_component).getOamVfMarkCreated() != null; ++ } ++ else if (FACET_NAME_KEY.length() == keyLength && ++ FACET_NAME_KEY.equals(key)) ++ { ++ return _component.getOamVfFacetName() != null; ++ } ++ else if (COMPONENT_ADDED_BY_HANDLER_MARKER.length() == keyLength && ++ COMPONENT_ADDED_BY_HANDLER_MARKER.equals(key)) { -- // Note we are not setting _isCompositeComponentSet, because when the component tree is built -- // using JSF 1.2 state saving, PostAddToViewEvent is propagated and the component is check -- // if is a composite component, but the state is not restored, so the check return always -- // false. A check for processing events was added to prevent that scenario, but anyway that -- // makes invalid set _isCompositeComponentSet to true on this location. -- _isCompositeComponent = getUnderlyingMap().containsKey(Resource.COMPONENT_RESOURCE_KEY); ++ return _component.isOamVfAddedByHandler(); ++ } ++ else if (FACET_CREATED_UIPANEL_MARKER.length() == keyLength && ++ FACET_CREATED_UIPANEL_MARKER.equals(key)) ++ { ++ return _component.isOamVfFacetCreatedUIPanel(); ++ } ++ // The most common call to this method comes from UIComponent.isCompositeComponent() ++ // to reduce the impact. This is better than two lookups, once over property descriptor map ++ // and the other one from the underlying map. ++ if (Resource.COMPONENT_RESOURCE_KEY.length() == keyLength && ++ Resource.COMPONENT_RESOURCE_KEY.equals(key)) ++ { ++ if (!_isCompositeComponentSet) ++ { ++ // Note we are not setting _isCompositeComponentSet, because when the component tree is built ++ // using JSF 1.2 state saving, PostAddToViewEvent is propagated and the component is check ++ // if is a composite component, but the state is not restored, so the check return always ++ // false. A check for processing events was added to prevent that scenario, but anyway that ++ // makes invalid set _isCompositeComponentSet to true on this location. ++ _isCompositeComponent = getUnderlyingMap().containsKey(Resource.COMPONENT_RESOURCE_KEY); ++ } ++ return _isCompositeComponent; } -- return _isCompositeComponent; } return getPropertyDescriptor((String) key) == null ? getUnderlyingMap().containsKey(key) : false; } @@@ -264,15 -264,15 +292,28 @@@ Object value; int keyLength = ((String)key).length(); -- if (MARK_CREATED.length() == keyLength && -- MARK_CREATED.equals(key)) ++ if (keyLength >= MIN_LENGHT_CHECK) { -- return _component.getOamVfMarkCreated(); -- } -- else if (FACET_NAME_KEY.length() == keyLength && -- FACET_NAME_KEY.equals(key)) -- { -- return _component.getOamVfFacetName(); ++ if (MARK_CREATED.length() == keyLength && ++ MARK_CREATED.equals(key)) ++ { ++ return _component.getOamVfMarkCreated(); ++ } ++ else if (FACET_NAME_KEY.length() == keyLength && ++ FACET_NAME_KEY.equals(key)) ++ { ++ return _component.getOamVfFacetName(); ++ } ++ else if (COMPONENT_ADDED_BY_HANDLER_MARKER.length() == keyLength && ++ COMPONENT_ADDED_BY_HANDLER_MARKER.equals(key)) ++ { ++ return _component.isOamVfAddedByHandler(); ++ } ++ else if (FACET_CREATED_UIPANEL_MARKER.length() == keyLength && ++ FACET_CREATED_UIPANEL_MARKER.equals(key)) ++ { ++ return _component.isOamVfFacetCreatedUIPanel(); ++ } } // is there a javabean property to read? _PropertyDescriptorHolder propertyDescriptor = getPropertyDescriptor((String) key); @@@ -301,19 -301,19 +342,25 @@@ } if (_isCompositeComponent) { -- BeanInfo ccBeanInfo = (BeanInfo) getUnderlyingMap().get(UIComponent.BEANINFO_KEY); ++ BeanInfo ccBeanInfo = _ccBeanInfo != null ? _ccBeanInfo : ++ (BeanInfo) getUnderlyingMap().get(UIComponent.BEANINFO_KEY); if (ccBeanInfo != null) { -- for (PropertyDescriptor attribute : ccBeanInfo.getPropertyDescriptors()) ++ //Fast shortcut to allow fast lookup. ++ Map attributeMap = (Map) ++ ccBeanInfo.getBeanDescriptor().getValue( ++ PROPERTY_DESCRIPTOR_MAP_KEY); ++ if (attributeMap != null) { -- if (attribute.getName().equals(key)) ++ PropertyDescriptor attribute = attributeMap.get(key); ++ if (attribute != null) { String attributeName = attribute.getName(); boolean isKnownMethod = "action".equals(attributeName) || "actionListener".equals(attributeName) || "validator".equals(attributeName) || "valueChangeListener".equals(attributeName); -- ++ // method-signature attribute is // ValueExpression that must evaluate to String ValueExpression methodSignatureExpression @@@ -322,11 -322,11 +369,12 @@@ if (methodSignatureExpression != null) { // Check if the value expression holds a method signature -- // Note that it could be null, so in that case we don't have to do anything ++ // Note that it could be null, so in that case we don't have to ++ // do anything methodSignature = (String) methodSignatureExpression.getValue( _component.getFacesContext().getELContext()); } -- ++ // either the attributeName has to be a knownMethod // or there has to be a method-signature if (isKnownMethod || methodSignature != null) @@@ -337,7 -337,7 +385,48 @@@ else { value = attribute.getValue("default"); -- break; ++ } ++ } ++ } ++ else ++ { ++ // Failsafe if another implementation for composite components is set ++ for (PropertyDescriptor attribute : ccBeanInfo.getPropertyDescriptors()) ++ { ++ if (attribute.getName().equals(key)) ++ { ++ String attributeName = attribute.getName(); ++ boolean isKnownMethod = "action".equals(attributeName) ++ || "actionListener".equals(attributeName) ++ || "validator".equals(attributeName) ++ || "valueChangeListener".equals(attributeName); ++ ++ // method-signature attribute is ++ // ValueExpression that must evaluate to String ++ ValueExpression methodSignatureExpression ++ = (ValueExpression) attribute.getValue("method-signature"); ++ String methodSignature = null; ++ if (methodSignatureExpression != null) ++ { ++ // Check if the value expression holds a method signature ++ // Note that it could be null, so in that case we don't have to ++ // do anything ++ methodSignature = (String) methodSignatureExpression.getValue( ++ _component.getFacesContext().getELContext()); ++ } ++ ++ // either the attributeName has to be a knownMethod ++ // or there has to be a method-signature ++ if (isKnownMethod || methodSignature != null) ++ { ++ //In this case it is expecting a ValueExpression ++ return attribute.getValue("default"); ++ } ++ else ++ { ++ value = attribute.getValue("default"); ++ break; ++ } } } } @@@ -372,19 -372,19 +461,41 @@@ { checkKey(key); int keyLength = ((String)key).length(); -- if (MARK_CREATED.length() == keyLength && -- MARK_CREATED.equals(key)) -- { -- Object oldValue = _component.getOamVfMarkCreated(); -- _component.setOamVfMarkCreated(null); -- return oldValue; -- } -- else if (FACET_NAME_KEY.length() == keyLength && -- FACET_NAME_KEY.equals(key)) ++ if (keyLength >= MIN_LENGHT_CHECK) { -- Object oldValue = _component.getOamVfFacetName(); -- _component.setOamVfFacetName(null); -- return oldValue; ++ if (MARK_CREATED.length() == keyLength && ++ MARK_CREATED.equals(key)) ++ { ++ Object oldValue = _component.getOamVfMarkCreated(); ++ _component.setOamVfMarkCreated(null); ++ return oldValue; ++ } ++ else if (FACET_NAME_KEY.length() == keyLength && ++ FACET_NAME_KEY.equals(key)) ++ { ++ Object oldValue = _component.getOamVfFacetName(); ++ _component.setOamVfFacetName(null); ++ return oldValue; ++ } ++ else if (COMPONENT_ADDED_BY_HANDLER_MARKER.length() == keyLength && ++ COMPONENT_ADDED_BY_HANDLER_MARKER.equals(key)) ++ { ++ Object oldValue = _component.isOamVfAddedByHandler(); ++ _component.setOamVfAddedByHandler(false); ++ return oldValue; ++ } ++ else if (FACET_CREATED_UIPANEL_MARKER.length() == keyLength && ++ FACET_CREATED_UIPANEL_MARKER.equals(key)) ++ { ++ Object oldValue = _component.isOamVfFacetCreatedUIPanel(); ++ _component.setOamVfFacetCreatedUIPanel(false); ++ return oldValue; ++ } ++ else if (UIComponent.BEANINFO_KEY.length() == keyLength ++ && UIComponent.BEANINFO_KEY.equals(key)) ++ { ++ _ccBeanInfo = null; ++ } } _PropertyDescriptorHolder propertyDescriptor = getPropertyDescriptor((String) key); if (propertyDescriptor != null) @@@ -428,19 -428,19 +539,37 @@@ { throw new NullPointerException("key"); } -- if (MARK_CREATED.length() == key.length() && -- MARK_CREATED.equals(key)) -- { -- String oldValue = _component.getOamVfMarkCreated(); -- _component.setOamVfMarkCreated((String)value); -- return oldValue; -- } -- else if (FACET_NAME_KEY.length() == key.length() && -- FACET_NAME_KEY.equals(key)) ++ int keyLength = ((String)key).length(); ++ if (keyLength >= MIN_LENGHT_CHECK) { -- Object oldValue = _component.getOamVfFacetName(); -- _component.setOamVfFacetName((String)value); -- return oldValue; ++ if (MARK_CREATED.length() == keyLength && ++ MARK_CREATED.equals(key)) ++ { ++ String oldValue = _component.getOamVfMarkCreated(); ++ _component.setOamVfMarkCreated((String)value); ++ return oldValue; ++ } ++ else if (FACET_NAME_KEY.length() == keyLength && ++ FACET_NAME_KEY.equals(key)) ++ { ++ Object oldValue = _component.getOamVfFacetName(); ++ _component.setOamVfFacetName((String)value); ++ return oldValue; ++ } ++ else if (COMPONENT_ADDED_BY_HANDLER_MARKER.length() == keyLength && ++ COMPONENT_ADDED_BY_HANDLER_MARKER.equals(key)) ++ { ++ Object oldValue = _component.isOamVfAddedByHandler(); ++ _component.setOamVfAddedByHandler((Boolean)value); ++ return oldValue; ++ } ++ else if (FACET_CREATED_UIPANEL_MARKER.length() == keyLength && ++ FACET_CREATED_UIPANEL_MARKER.equals(key)) ++ { ++ Object oldValue = _component.isOamVfFacetCreatedUIPanel(); ++ _component.setOamVfFacetCreatedUIPanel((Boolean)value); ++ return oldValue; ++ } } _PropertyDescriptorHolder propertyDescriptor = getPropertyDescriptor(key); if (propertyDescriptor == null) @@@ -463,12 -463,12 +592,17 @@@ } // To keep this code in good shape, The fastest way to compare is look if the length first here // because we avoid an unnecessary cast later on equals(). -- if ( Resource.COMPONENT_RESOURCE_KEY.length() == key.length() ++ if ( Resource.COMPONENT_RESOURCE_KEY.length() == keyLength && Resource.COMPONENT_RESOURCE_KEY.equals(key)) { _isCompositeComponent = true; _isCompositeComponentSet = true; } ++ if (UIComponent.BEANINFO_KEY.length() == keyLength ++ && UIComponent.BEANINFO_KEY.equals(key)) ++ { ++ _ccBeanInfo = (BeanInfo) value; ++ } return _component.getStateHelper().put(UIComponentBase.PropertyKeys.attributesMap, key, value); } diff --cc api/src/main/java/javax/faces/context/PartialResponseWriter.java index ef58376,ef58376..4b54a99 --- a/api/src/main/java/javax/faces/context/PartialResponseWriter.java +++ b/api/src/main/java/javax/faces/context/PartialResponseWriter.java @@@ -146,6 -146,6 +146,13 @@@ public class PartialResponseWriter exte _wrapped.write (""); _wrapped.startElement ("partial-response", null); ++ ++ // If by some reason the response has been reset, and the same ++ // PartialResponseWriter is used, it is necessary to ensure any ++ // variable is initialized in a consistent state. To do that, ++ // the best point is when the document is started. ++ hasChanges = false; ++ insertType = null; } public void startError(String errorName) throws IOException diff --cc api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomExperimental.js index 7e72827,b709c63..bc30adf --- a/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomExperimental.js +++ b/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_DomExperimental.js @@@ -103,13 -118,13 +118,11 @@@ if (_MF_SINGLTN) executes = this._Lang.strToArray(executes, /\s+/); } -- for (var executable in executes) { -- if (!executes.hasOwnProperty(executable)) continue; -- var element = this.byId(executes[executable]); ++ for (var cnt = 0, len = executes.length; cnt < len ; cnt ++) { ++ var element = this.byId(executes[cnt]); var inputs = this.findByTagName(element, "input", true); -- for (var key in inputs) { -- if (!inputs.hasOwnProperty(key)) continue; -- if (this.getAttribute(inputs[key], "type") == "file") return true; ++ for (var cnt2 = 0, len2 = inputs.length; cnt2 < len2 ; cnt2++) { ++ if (this.getAttribute(inputs[cnt2], "type") == "file") return true; } } return false; diff --cc api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js index 8e25a8c,8e25a8c..a845378 --- a/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js +++ b/api/src/main/javascript/META-INF/resources/myfaces/_impl/core/Impl.js @@@ -232,7 -232,7 +232,10 @@@ _MF_SINGLTN(_PFX_CORE + "Impl", _MF_OBJ /*compliance with Mojarra which automatically adds @this to an execute * the spec rev 2.0a however states, if none is issued nothing at all should be sent down */ -- this._transformList(passThrgh, this.P_EXECUTE, options.execute + " @this", form, elementId); ++ if(options.execute.indexOf("@this") == -1) { ++ options.execute = options.execute + " @this"; ++ } ++ this._transformList(passThrgh, this.P_EXECUTE, options.execute, form, elementId); } else { passThrgh[this.P_EXECUTE] = elementId; } @@@ -375,6 -375,6 +378,7 @@@ //it uses an array and an index to position all elements correctly //the offset variable is there to prevent 0 which results in a javascript //false ++ srcStr = _Lang.trim(srcStr); var offset = 1, vals = (srcStr) ? srcStr.split(/\s+/) : [], idIdx = (vals.length) ? _Lang.arrToMap(vals, offset) : {}, @@@ -386,8 -386,8 +390,10 @@@ theForm = idIdx[this.IDENT_FORM]; if (none) { -- //in case of none only one value is returned -- passThrgh[target] = this.IDENT_NONE; ++ //in case of none nothing is returned ++ if('undefined' != typeof passThrgh.target) { ++ delete passThrgh.target; ++ } return passThrgh; } if (all) { diff --cc api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js index 6a2c57a,c63a762..592de8e --- a/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js +++ b/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_AjaxResponse.js @@@ -603,7 -603,7 +603,7 @@@ _MF_SINGLTN(_PFX_XHR + "_AjaxResponse" _Dom.byIdOrName(itemIdToReplace); if (!item) { - throw this._raiseError(_Lang.getMessage("ERR_ITEM_ID_NOTFOUND", null, "_AjaxResponse.replaceHtmlItem", (itemIdToReplace) ? itemIdToReplace.toString() : "undefined")); - throw this._raiseError(_Lang.getMessage("ERR_ITEM_ID_NOTFOUND", null, "_AjaxResponse.replaceHtmlItem", (itemIdToReplace) ? itemIdToReplace.toString() : "undefined"),"replaceHtmlItem"); ++ throw this._raiseError(new Error(), _Lang.getMessage("ERR_ITEM_ID_NOTFOUND", null, "_AjaxResponse.replaceHtmlItem", (itemIdToReplace) ? itemIdToReplace.toString() : "undefined"),"replaceHtmlItem"); } return _Dom.outerHTML(item, markup); }, diff --cc api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js index 6c12b75,6c12b75..d34f8bb --- a/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js +++ b/api/src/main/javascript/META-INF/resources/myfaces/_impl/xhrCore/_Transports.js @@@ -159,7 -159,7 +159,7 @@@ _MF_SINGLTN(_PFX_XHR + "_Transports", _ _getAjaxReqClass: function(context) { // var _RT = myfaces._impl.core._Runtime; //if(_RT.getXHRLvl() < 2) { -- return myfaces._impl.xhrCore._AjaxRequest; ++ return myfaces._impl.xhrCore._AjaxRequest; //} else { // return myfaces._impl.xhrCore._AjaxRequestLevel2; //} diff --cc impl/pom.xml index ca16783,7ee191e..b806bf4 --- a/impl/pom.xml +++ b/impl/pom.xml @@@ -465,7 -503,7 +503,6 @@@ maven-surefire-plugin -- 2.5 none:none diff --cc impl/src/main/java/org/apache/myfaces/application/ViewHandlerImpl.java index fbc287a,fbc287a..d95b275 --- a/impl/src/main/java/org/apache/myfaces/application/ViewHandlerImpl.java +++ b/impl/src/main/java/org/apache/myfaces/application/ViewHandlerImpl.java @@@ -97,7 -97,7 +97,7 @@@ public class ViewHandlerImpl extends Vi try { //TODO: JSF 2.0 - need to make sure calculateViewId follows the new algorithm from 7.5.2 -- return getViewHandlerSupport().calculateAndCheckViewId(context, input); ++ return getViewHandlerSupport(context).calculateAndCheckViewId(context, input); } catch (InvalidViewIdException e) { @@@ -115,7 -115,7 +115,7 @@@ try { //TODO: JSF 2.0 - need to make sure calculateViewId follows the new algorithm from 7.5.2 -- return getViewHandlerSupport().calculateViewId(context, rawViewId); ++ return getViewHandlerSupport(context).calculateViewId(context, rawViewId); } catch (InvalidViewIdException e) { @@@ -241,7 -241,7 +241,7 @@@ public UIViewRoot createView(FacesContext context, String viewId) { checkNull(context, "facesContext"); -- String calculatedViewId = getViewHandlerSupport().calculateViewId(context, viewId); ++ String calculatedViewId = getViewHandlerSupport(context).calculateViewId(context, viewId); // we cannot use this.getVDL() directly (see getViewHandler()) //return getViewHandler(context) @@@ -254,7 -254,7 +254,7 @@@ @Override public String getActionURL(FacesContext context, String viewId) { -- return getViewHandlerSupport().calculateActionURL(context, viewId); ++ return getViewHandlerSupport(context).calculateActionURL(context, viewId); } @Override @@@ -290,7 -290,7 +290,7 @@@ { checkNull(context, "context"); -- String calculatedViewId = getViewHandlerSupport().calculateViewId(context, viewId); ++ String calculatedViewId = getViewHandlerSupport(context).calculateViewId(context, viewId); // we cannot use this.getVDL() directly (see getViewHandler()) //return getViewHandler(context) @@@ -404,7 -404,7 +404,7 @@@ } else { -- String calculatedViewId = getViewHandlerSupport().calculateViewId(context, viewId); ++ String calculatedViewId = getViewHandlerSupport(context).calculateViewId(context, viewId); // we cannot use this.getVDL() directly (see getViewHandler()) //ViewDeclarationLanguage vdl = getViewHandler(context). // getViewDeclarationLanguage(context, calculatedViewId); @@@ -503,9 -503,9 +503,14 @@@ protected ViewHandlerSupport getViewHandlerSupport() { ++ return getViewHandlerSupport(FacesContext.getCurrentInstance()); ++ } ++ ++ protected ViewHandlerSupport getViewHandlerSupport(FacesContext context) ++ { if (_viewHandlerSupport == null) { -- _viewHandlerSupport = new DefaultViewHandlerSupport(); ++ _viewHandlerSupport = new DefaultViewHandlerSupport(context); } return _viewHandlerSupport; } diff --cc impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java index 9dcb5ee,9dcb5ee..4e966a2 --- a/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java +++ b/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java @@@ -661,9 -661,9 +661,9 @@@ public class PartialViewContextImpl ext { for (UIComponent grandchild : child.getChildren()) { -- if (child instanceof HtmlHead) ++ if (grandchild instanceof HtmlHead) { -- return child; ++ return grandchild; } } } @@@ -683,9 -683,9 +683,9 @@@ { for (UIComponent grandchild : child.getChildren()) { -- if (child instanceof HtmlBody) ++ if (grandchild instanceof HtmlBody) { -- return child; ++ return grandchild; } } } diff --cc impl/src/main/java/org/apache/myfaces/el/unified/resolver/CompositeComponentELResolver.java index cd832ea,cd832ea..7e89462 --- a/impl/src/main/java/org/apache/myfaces/el/unified/resolver/CompositeComponentELResolver.java +++ b/impl/src/main/java/org/apache/myfaces/el/unified/resolver/CompositeComponentELResolver.java @@@ -37,6 -37,6 +37,7 @@@ import javax.faces.el.CompositeComponen import org.apache.myfaces.shared.config.MyfacesConfig; import org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage; ++import org.apache.myfaces.view.facelets.tag.composite.CompositeComponentBeanInfo; /** * Composite component attribute EL resolver. See JSF spec, section 5.6.2.2. @@@ -275,6 -275,6 +276,7 @@@ public final class CompositeComponentEL private final BeanInfo _beanInfo; private final Map _originalMap; private final PropertyDescriptor [] _propertyDescriptors; ++ private final CompositeComponentBeanInfo _ccBeanInfo; private CompositeComponentAttributesMapWrapper(UIComponent component) { @@@ -282,6 -282,6 +284,8 @@@ this._originalMap = component.getAttributes(); this._beanInfo = (BeanInfo) _originalMap.get(UIComponent.BEANINFO_KEY); this._propertyDescriptors = _beanInfo.getPropertyDescriptors(); ++ this._ccBeanInfo = (this._beanInfo instanceof CompositeComponentBeanInfo) ? ++ (CompositeComponentBeanInfo) this._beanInfo : null; } public ValueExpression getExpression(String name) @@@ -327,12 -327,12 +331,23 @@@ } else { -- for (PropertyDescriptor attribute : _propertyDescriptors) ++ if (_ccBeanInfo == null) { -- if (attribute.getName().equals(key)) ++ for (PropertyDescriptor attribute : _propertyDescriptors) ++ { ++ if (attribute.getName().equals(key)) ++ { ++ obj = attribute.getValue("default"); ++ break; ++ } ++ } ++ } ++ else ++ { ++ PropertyDescriptor attribute = _ccBeanInfo.getPropertyDescriptorsMap().get(key); ++ if (attribute != null) { obj = attribute.getValue("default"); -- break; } } // We have to check for a ValueExpression and also evaluate it diff --cc impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceBundleResolver.java index ef7f160,ef7f160..3177e06 --- a/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceBundleResolver.java +++ b/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceBundleResolver.java @@@ -55,6 -55,6 +55,17 @@@ public final class ResourceBundleResolv public void setValue(final ELContext context, final Object base, final Object property, final Object value) throws NullPointerException, PropertyNotFoundException, PropertyNotWritableException, ELException { ++ // JSF 2.0 spec section 5.6.1.4 ++ // "... If base is null and property is a String equal to the value of the ++ // element of one of the 's in the application ++ // configuration resources throw javax.el.PropertyNotWriteable, since ++ // ResourceBundles are read-only. ..." ++ // Since something is done only when base is null, it is better to check ++ // for not null and return. ++ if (base != null) ++ { ++ return; ++ } if ((base == null) && (property == null)) { @@@ -66,6 -66,6 +77,7 @@@ return; } ++ // base is null and property is a String value, check for resource bundle. final ResourceBundle bundle = getResourceBundle(context, (String)property); if (bundle != null) diff --cc impl/src/main/java/org/apache/myfaces/lifecycle/DefaultRestoreViewSupport.java index 13a14c7,13a14c7..9c00b9d --- a/impl/src/main/java/org/apache/myfaces/lifecycle/DefaultRestoreViewSupport.java +++ b/impl/src/main/java/org/apache/myfaces/lifecycle/DefaultRestoreViewSupport.java @@@ -93,6 -93,6 +93,27 @@@ public class DefaultRestoreViewSupport private RenderKitFactory _renderKitFactory = null; private VisitContextFactory _visitContextFactory = null; ++ ++ private final String[] _faceletsViewMappings; ++ private final String[] _contextSuffixes; ++ private final String _faceletsContextSufix; ++ private final boolean _initialized; ++ ++ public DefaultRestoreViewSupport() ++ { ++ _faceletsViewMappings = null; ++ _contextSuffixes = null; ++ _faceletsContextSufix = null; ++ _initialized = false; ++ } ++ ++ public DefaultRestoreViewSupport(FacesContext facesContext) ++ { ++ _faceletsViewMappings = getFaceletsViewMappings(facesContext); ++ _contextSuffixes = getContextSuffix(facesContext); ++ _faceletsContextSufix = getFaceletsContextSuffix(facesContext); ++ _initialized = true; ++ } public void processComponentBinding(FacesContext facesContext, UIComponent component) { @@@ -387,8 -387,8 +408,8 @@@ */ protected String handleSuffixMapping(FacesContext context, String requestViewId) { -- String[] faceletsViewMappings = getFaceletsViewMappings(context); -- String[] jspDefaultSuffixes = getContextSuffix(context); ++ String[] faceletsViewMappings = _initialized ? _faceletsViewMappings : getFaceletsViewMappings(context); ++ String[] jspDefaultSuffixes = _initialized ? _contextSuffixes : getContextSuffix(context); int slashPos = requestViewId.lastIndexOf('/'); int extensionPos = requestViewId.lastIndexOf('.'); @@@ -443,7 -443,7 +464,7 @@@ } //jsp suffixes didn't match, try facelets suffix -- String faceletsDefaultSuffix = this.getFaceletsContextSuffix(context); ++ String faceletsDefaultSuffix = _initialized ? _faceletsContextSufix : this.getFaceletsContextSuffix(context); if (faceletsDefaultSuffix != null) { for (String defaultSuffix : jspDefaultSuffixes) diff --cc impl/src/main/java/org/apache/myfaces/lifecycle/RestoreViewExecutor.java index 7da7d88,7da7d88..5a2cc9b --- a/impl/src/main/java/org/apache/myfaces/lifecycle/RestoreViewExecutor.java +++ b/impl/src/main/java/org/apache/myfaces/lifecycle/RestoreViewExecutor.java @@@ -79,7 -79,7 +79,7 @@@ class RestoreViewExecutor extends Phase Application application = facesContext.getApplication(); ViewHandler viewHandler = application.getViewHandler(); UIViewRoot viewRoot = facesContext.getViewRoot(); -- RestoreViewSupport restoreViewSupport = getRestoreViewSupport(); ++ RestoreViewSupport restoreViewSupport = getRestoreViewSupport(facesContext); // Examine the FacesContext instance for the current request. If it already contains a UIViewRoot if (viewRoot != null) @@@ -284,9 -284,9 +284,14 @@@ protected RestoreViewSupport getRestoreViewSupport() { ++ return getRestoreViewSupport(FacesContext.getCurrentInstance()); ++ } ++ ++ protected RestoreViewSupport getRestoreViewSupport(FacesContext context) ++ { if (_restoreViewSupport == null) { -- _restoreViewSupport = new DefaultRestoreViewSupport(); ++ _restoreViewSupport = new DefaultRestoreViewSupport(context); } return _restoreViewSupport; } diff --cc impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java index 39e149a,39e149a..f946b19 --- a/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java +++ b/impl/src/main/java/org/apache/myfaces/view/facelets/DefaultFaceletsStateManagementStrategy.java @@@ -1173,10 -1173,10 +1173,7 @@@ public class DefaultFaceletsStateManage if (!isRefreshOnTransientBuildPreserveState() && FaceletCompositionContext.getCurrentInstance(_facesContext) != null && (component.getAttributes().containsKey(ComponentSupport.MARK_CREATED) || -- component.getAttributes().containsKey(ComponentSupport.FACET_CREATED_UIPANEL_MARKER)) || -- (component.getId() != null && component.getId().length() > 16 && -- component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX) && -- component.getId().endsWith("__f_cc_facet") ) ++ component.getAttributes().containsKey(ComponentSupport.COMPONENT_ADDED_BY_HANDLER_MARKER)) ) { // Components removed by facelets algorithm does not need to be registered diff --cc impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java index fd55e88,fd55e88..45bba6d --- a/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java +++ b/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java @@@ -106,14 -106,14 +106,6 @@@ public final class CompositeComponentEL final Location location) { //1 Use getCurrentComponent and getCurrentCompositeComponent to look on the component stack -- UIComponent currentComponent = UIComponent.getCurrentComponent(facesContext); -- -- if (currentComponent == null) -- { -- // Cannot found any component, because we don't have any reference! -- return null; -- } -- UIComponent currentCompositeComponent = UIComponent.getCurrentCompositeComponent(facesContext); //1.1 Use getCurrentCompositeComponent first! @@@ -126,7 -126,7 +118,15 @@@ return currentCompositeComponent; } } ++ ++ UIComponent currentComponent = UIComponent.getCurrentComponent(facesContext); ++ if (currentComponent == null) ++ { ++ // Cannot found any component, because we don't have any reference! ++ return null; ++ } ++ //2. Look on the stack using a recursive algorithm. UIComponent matchingCompositeComponent = lookForCompositeComponentOnStack(facesContext, location, currentComponent); @@@ -265,14 -265,14 +265,6 @@@ final Location location, int ccLevel) { //1 Use getCurrentComponent and getCurrentCompositeComponent to look on the component stack -- UIComponent currentComponent = UIComponent.getCurrentComponent(facesContext); -- -- if (currentComponent == null) -- { -- // Cannot found any component, because we don't have any reference! -- return null; -- } -- UIComponent currentCompositeComponent = UIComponent.getCurrentCompositeComponent(facesContext); //1.1 Use getCurrentCompositeComponent first! @@@ -286,6 -286,6 +278,14 @@@ return currentCompositeComponent; } } ++ ++ UIComponent currentComponent = UIComponent.getCurrentComponent(facesContext); ++ ++ if (currentComponent == null) ++ { ++ // Cannot found any component, because we don't have any reference! ++ return null; ++ } //2. Look on the stack using a recursive algorithm. UIComponent matchingCompositeComponent diff --cc impl/src/main/java/org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java index 029dd69,029dd69..6ab7a6a --- a/impl/src/main/java/org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java +++ b/impl/src/main/java/org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java @@@ -59,19 -59,19 +59,44 @@@ public class ValueExpressionMethodExpre @Override public MethodInfo getMethodInfo(ELContext context) { -- return getMethodExpression(context).getMethodInfo(context); ++ MethodExpression me = getMethodExpression(context); ++ if (me != null) ++ { ++ return me.getMethodInfo(context); ++ } ++ return null; } @Override public Object invoke(ELContext context, Object[] params) { -- return getMethodExpression(context).invoke(context, params); ++ MethodExpression me = getMethodExpression(context); ++ if (me != null) ++ { ++ return me.invoke(context, params); ++ } ++ return null; } @Override public boolean equals(Object obj) { -- return getMethodExpression().equals(obj); ++ MethodExpression me = getMethodExpression(); ++ if (me != null) ++ { ++ return me.equals(obj); ++ } ++ if (!(obj instanceof ValueExpressionMethodExpression)) ++ { ++ return false; ++ } ++ ValueExpressionMethodExpression other = (ValueExpressionMethodExpression) obj; ++ if ((this.valueExpression == null && other.valueExpression != null) || ++ (this.valueExpression != null && !this.valueExpression.equals(other.valueExpression))) ++ { ++ return false; ++ } ++ return true; } @Override @@@ -84,13 -84,13 +109,23 @@@ @Override public int hashCode() { -- return getMethodExpression().hashCode(); ++ MethodExpression me = getMethodExpression(); ++ if (me != null) ++ { ++ return me.hashCode(); ++ } ++ return valueExpression.hashCode(); } @Override public boolean isLiteralText() { -- return getMethodExpression().isLiteralText(); ++ MethodExpression me = getMethodExpression(); ++ if (me != null) ++ { ++ return me.isLiteralText(); ++ } ++ return valueExpression.isLiteralText(); } private MethodExpression getMethodExpression() diff --cc impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentBeanInfo.java index e3b0c03,e3b0c03..65e2371 --- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentBeanInfo.java +++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentBeanInfo.java @@@ -26,10 -26,10 +26,13 @@@ import java.io.IOException import java.io.ObjectInput; import java.io.ObjectOutput; import java.util.ArrayList; ++import java.util.Collection; ++import java.util.Collections; import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; ++import java.util.Set; import javax.faces.view.AttachedObjectTarget; @@@ -72,6 -72,6 +75,8 @@@ public class CompositeComponentBeanInfo extends SimpleBeanInfo implements Externalizable { ++ ++ public static final String PROPERTY_DESCRIPTOR_MAP_KEY = "oam.cc.beanInfo.PDM"; /** * Most of the information here are filled on composite:interface tag. @@@ -95,6 -95,6 +100,8 @@@ private PropertyDescriptor[] _propertyDescriptorsArray; ++ private Map _propertyDescriptorsMap; ++ /** * Used for Serialization */ @@@ -107,6 -107,6 +114,7 @@@ { super(); _descriptor = descriptor; ++ getBeanDescriptor().setValue(PROPERTY_DESCRIPTOR_MAP_KEY, new PropertyDescriptorMap()); } @Override @@@ -170,6 -170,6 +178,7 @@@ _descriptor.setName((String) in.readObject()); _descriptor.setPreferred(in.readBoolean()); _descriptor.setShortDescription((String) in.readObject()); ++ _descriptor.setValue(PROPERTY_DESCRIPTOR_MAP_KEY, new PropertyDescriptorMap()); Map map = (Map) in.readObject(); @@@ -200,7 -200,7 +209,8 @@@ // we only use it when VDL.retargetAttachedObjects() is called and this only // happen when the view is built. Also, try to serialize this instances could // cause unwanted exceptions. -- if (!AttachedObjectTarget.ATTACHED_OBJECT_TARGETS_KEY.equals(name)) ++ if (!AttachedObjectTarget.ATTACHED_OBJECT_TARGETS_KEY.equals(name) && ++ !PROPERTY_DESCRIPTOR_MAP_KEY.equals(name)) { map.put(name, _descriptor.getValue(name)); } @@@ -209,4 -209,4 +219,122 @@@ out.writeObject(_propertyDescriptors); } ++ ++ public Map getPropertyDescriptorsMap() ++ { ++ if (_propertyDescriptors == null) ++ { ++ return Collections.emptyMap(); ++ } ++ else ++ { ++ if (_propertyDescriptors.isEmpty()) ++ { ++ return Collections.emptyMap(); ++ } ++ else if (_propertyDescriptorsMap == null) ++ { ++ int initCapacity = (_propertyDescriptors.size() * 4 + 3) / 3; ++ _propertyDescriptorsMap = new HashMap(initCapacity); ++ for (PropertyDescriptor p : _propertyDescriptors) ++ { ++ if (!_propertyDescriptorsMap.containsKey(p.getName())) ++ { ++ _propertyDescriptorsMap.put(p.getName(), p); ++ } ++ } ++ } ++ else if (_propertyDescriptorsMap.size() != _propertyDescriptors.size()) ++ { ++ for (PropertyDescriptor p : _propertyDescriptors) ++ { ++ if (!_propertyDescriptorsMap.containsKey(p.getName())) ++ { ++ _propertyDescriptorsMap.put(p.getName(), p); ++ } ++ } ++ if (_propertyDescriptorsMap.size() != _propertyDescriptors.size()) ++ { ++ // PropertyDescriptor was removed ++ _propertyDescriptorsMap.clear(); ++ for (PropertyDescriptor p : _propertyDescriptors) ++ { ++ if (!_propertyDescriptorsMap.containsKey(p.getName())) ++ { ++ _propertyDescriptorsMap.put(p.getName(), p); ++ } ++ } ++ } ++ } ++ return _propertyDescriptorsMap; ++ } ++ } ++ ++ /** ++ * Read only map for fast access. It works as an indirection over the real list. ++ */ ++ public class PropertyDescriptorMap implements Map ++ { ++ ++ public int size() ++ { ++ return getPropertyDescriptorsMap().size(); ++ } ++ ++ public boolean isEmpty() ++ { ++ return getPropertyDescriptorsMap().isEmpty(); ++ } ++ ++ ++ public boolean containsKey(Object key) ++ { ++ return getPropertyDescriptorsMap().containsKey(key); ++ } ++ ++ public boolean containsValue(Object value) ++ { ++ return getPropertyDescriptorsMap().containsValue(value); ++ } ++ ++ public PropertyDescriptor get(Object key) ++ { ++ return getPropertyDescriptorsMap().get(key); ++ } ++ ++ public PropertyDescriptor put(String key, PropertyDescriptor value) ++ { ++ throw new UnsupportedOperationException(); ++ } ++ ++ public PropertyDescriptor remove(Object key) ++ { ++ throw new UnsupportedOperationException(); ++ } ++ ++ public void putAll(Map m) ++ { ++ throw new UnsupportedOperationException(); ++ } ++ ++ public void clear() ++ { ++ throw new UnsupportedOperationException(); ++ } ++ ++ public Set keySet() ++ { ++ return getPropertyDescriptorsMap().keySet(); ++ } ++ ++ public Collection values() ++ { ++ return getPropertyDescriptorsMap().values(); ++ } ++ ++ public Set> entrySet() ++ { ++ return getPropertyDescriptorsMap().entrySet(); ++ } ++ } } diff --cc impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java index c24efdf,c24efdf..ce31960 --- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java +++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java @@@ -319,6 -319,6 +319,8 @@@ public class CompositeComponentResource compositeFacetPanel = (UIPanel) faceletContext.getFacesContext().getApplication().createComponent( faceletContext.getFacesContext(), UIPanel.COMPONENT_TYPE, null); ++ compositeFacetPanel.getAttributes().put(ComponentSupport.COMPONENT_ADDED_BY_HANDLER_MARKER, ++ Boolean.TRUE); compositeComponentBase.getFacets().put(UIComponent.COMPOSITE_FACET_NAME, compositeFacetPanel); // Set an id to the created facet component, to prevent id generation and make diff --cc impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java index 07c3177,07c3177..8560307 --- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java +++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java @@@ -59,7 -59,7 +59,14 @@@ public final class ComponentSuppor * This constant is duplicate in javax.faces.webapp.UIComponentClassicTagBase */ public final static String FACET_CREATED_UIPANEL_MARKER = "oam.vf.createdUIPanel"; -- ++ ++ /** ++ * Special myfaces core marker to indicate the component is handled by a facelet tag handler, ++ * so its creation is not handled by user programatically and PSS remove listener should ++ * not register it when a remove happens. ++ */ ++ public final static String COMPONENT_ADDED_BY_HANDLER_MARKER = "oam.vf.addedByHandler"; ++ /** * The key under the facelet state map is stored */ @@@ -418,6 -418,6 +425,7 @@@ .append(cleanFacetName).toString())); } panel.getAttributes().put(FACET_CREATED_UIPANEL_MARKER, Boolean.TRUE); ++ panel.getAttributes().put(ComponentSupport.COMPONENT_ADDED_BY_HANDLER_MARKER, Boolean.TRUE); return panel; } diff --cc impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ViewMetadataHandler.java index 02bf93b,02bf93b..16cac30 --- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ViewMetadataHandler.java +++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ViewMetadataHandler.java @@@ -69,6 -69,6 +69,7 @@@ public final class ViewMetadataHandler ctx.getFacesContext(), UIPanel.COMPONENT_TYPE, null); metadataFacet.setId(UIViewRoot.METADATA_FACET_NAME); metadataFacet.getAttributes().put(ComponentSupport.FACET_CREATED_UIPANEL_MARKER, true); ++ metadataFacet.getAttributes().put(ComponentSupport.COMPONENT_ADDED_BY_HANDLER_MARKER, Boolean.TRUE); parent.getFacets().put(UIViewRoot.METADATA_FACET_NAME, metadataFacet); } } diff --cc impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java index 8cccb0d,8cccb0d..56980b6 --- a/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java +++ b/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java @@@ -181,7 -181,7 +181,14 @@@ public class RestoreViewExecutorTest ex */ public void testGetRestoreViewSupport() throws Exception { -- assertTrue(DefaultRestoreViewSupport.class.equals(new RestoreViewExecutor().getRestoreViewSupport().getClass())); ++ expect(_facesContext.getExternalContext()).andReturn(_externalContext).anyTimes(); ++ expect(_externalContext.getInitParameter("javax.faces.FACELETS_VIEW_MAPPINGS")).andReturn(null).anyTimes(); ++ expect(_externalContext.getInitParameter("facelets.VIEW_MAPPINGS")).andReturn(null).anyTimes(); ++ expect(_externalContext.getInitParameter("javax.faces.FACELETS_SUFFIX")).andReturn(null).anyTimes(); ++ expect(_externalContext.getInitParameter("javax.faces.DEFAULT_SUFFIX")).andReturn(null).anyTimes(); ++ _mocksControl.replay(); ++ assertTrue(DefaultRestoreViewSupport.class.equals(new RestoreViewExecutor().getRestoreViewSupport(_facesContext).getClass())); ++ _mocksControl.verify(); } /** diff --cc shared/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java index 132b7ff,132b7ff..b414789 --- a/shared/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java +++ b/shared/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java @@@ -79,6 -79,6 +79,27 @@@ public class DefaultViewHandlerSupport private volatile ConcurrentLRUCache _checkedViewIdMap = null; private Boolean _checkedViewIdCacheEnabled = null; ++ ++ private final String[] _faceletsViewMappings; ++ private final String[] _contextSuffixes; ++ private final String _faceletsContextSufix; ++ private final boolean _initialized; ++ ++ public DefaultViewHandlerSupport() ++ { ++ _faceletsViewMappings = null; ++ _contextSuffixes = null; ++ _faceletsContextSufix = null; ++ _initialized = false; ++ } ++ ++ public DefaultViewHandlerSupport(FacesContext facesContext) ++ { ++ _faceletsViewMappings = getFaceletsViewMappings(facesContext); ++ _contextSuffixes = getContextSuffix(facesContext); ++ _faceletsContextSufix = getFaceletsContextSuffix(facesContext); ++ _initialized = true; ++ } public String calculateViewId(FacesContext context, String viewId) { @@@ -183,7 -183,7 +204,7 @@@ if (mapping.isExtensionMapping()) { //See JSF 2.0 section 7.5.2 -- String[] contextSuffixes = getContextSuffix(context); ++ String[] contextSuffixes = _initialized ? _contextSuffixes : getContextSuffix(context); boolean founded = false; for (String contextSuffix : contextSuffixes) { @@@ -408,8 -408,8 +429,8 @@@ */ protected String handleSuffixMapping(FacesContext context, String requestViewId) { -- String[] faceletsViewMappings = getFaceletsViewMappings(context); -- String[] jspDefaultSuffixes = getContextSuffix(context); ++ String[] faceletsViewMappings = _initialized ? _faceletsViewMappings : getFaceletsViewMappings(context); ++ String[] jspDefaultSuffixes = _initialized ? _contextSuffixes : getContextSuffix(context); int slashPos = requestViewId.lastIndexOf('/'); int extensionPos = requestViewId.lastIndexOf('.'); @@@ -468,7 -468,7 +489,7 @@@ } //jsp suffixes didn't match, try facelets suffix -- String faceletsDefaultSuffix = this.getFaceletsContextSuffix(context); ++ String faceletsDefaultSuffix = _initialized ? _faceletsContextSufix : this.getFaceletsContextSuffix(context); if (faceletsDefaultSuffix != null) { for (String defaultSuffix : jspDefaultSuffixes) diff --cc shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java index 30ccc6e,30ccc6e..603308f --- a/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java +++ b/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java @@@ -220,7 -220,7 +220,14 @@@ public class HtmlCheckboxRendererBase e } writer.startElement(HTML.TD_ELEM, selectMany); -- writer.write(selectItem.getLabel()); ++ if (selectItem.isEscape()) ++ { ++ writer.writeText(selectItem.getLabel(),HTML.LABEL_ATTR); ++ } ++ else ++ { ++ writer.write(selectItem.getLabel()); ++ } writer.endElement(HTML.TD_ELEM); if (pageDirectionLayout) diff --cc shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java index 6b383d3,6b383d3..b617554 --- a/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java +++ b/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java @@@ -194,7 -194,7 +194,14 @@@ public class HtmlRadioRendererBas } writer.startElement(HTML.TD_ELEM, selectOne); -- writer.write(selectItem.getLabel()); ++ if (selectItem.isEscape()) ++ { ++ writer.writeText(selectItem.getLabel(),HTML.LABEL_ATTR); ++ } ++ else ++ { ++ writer.write(selectItem.getLabel()); ++ } writer.endElement(HTML.TD_ELEM); if (pageDirectionLayout) diff --cc shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java index 7df2bba,7df2bba..21bee1e --- a/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java +++ b/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java @@@ -21,8 -21,8 +21,6 @@@ package org.apache.myfaces.shared.rende import java.io.IOException; import java.io.Writer; import java.nio.charset.Charset; --import java.util.HashSet; --import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; @@@ -100,8 -100,8 +98,6 @@@ public class HtmlResponseWriterImp private boolean _cdataOpen; -- private static final Set S_EMPTY_HTML_ELEMENTS = new HashSet(); -- private static final String CDATA_START = ""; private static final String COMMENT_END = "\n-->"; -- static ++ static private final String[][] EMPTY_ELEMENT_ARR = new String[256][]; ++ ++ static private final String[] A_NAMES = new String[] { -- S_EMPTY_HTML_ELEMENTS.add("area"); -- S_EMPTY_HTML_ELEMENTS.add("br"); -- S_EMPTY_HTML_ELEMENTS.add("base"); -- S_EMPTY_HTML_ELEMENTS.add("basefont"); -- S_EMPTY_HTML_ELEMENTS.add("col"); -- S_EMPTY_HTML_ELEMENTS.add("frame"); -- S_EMPTY_HTML_ELEMENTS.add("hr"); -- S_EMPTY_HTML_ELEMENTS.add("img"); -- S_EMPTY_HTML_ELEMENTS.add("input"); -- S_EMPTY_HTML_ELEMENTS.add("isindex"); -- S_EMPTY_HTML_ELEMENTS.add("link"); -- S_EMPTY_HTML_ELEMENTS.add("meta"); -- S_EMPTY_HTML_ELEMENTS.add("param"); -- } ++ "area", ++ }; ++ ++ static private final String[] B_NAMES = new String[] ++ { ++ "br", ++ "base", ++ "basefont", ++ }; ++ ++ static private final String[] C_NAMES = new String[] ++ { ++ "col", ++ }; ++ ++ static private final String[] E_NAMES = new String[] ++ { ++ "embed", ++ }; ++ ++ static private final String[] F_NAMES = new String[] ++ { ++ "frame", ++ }; ++ ++ static private final String[] H_NAMES = new String[] ++ { ++ "hr", ++ }; ++ ++ static private final String[] I_NAMES = new String[] ++ { ++ "img", ++ "input", ++ "isindex", ++ }; ++ ++ static private final String[] L_NAMES = new String[] ++ { ++ "link", ++ }; ++ static private final String[] M_NAMES = new String[] ++ { ++ "meta", ++ }; ++ ++ static private final String[] P_NAMES = new String[] ++ { ++ "param", ++ }; ++ ++ static ++ { ++ EMPTY_ELEMENT_ARR['a'] = A_NAMES; ++ EMPTY_ELEMENT_ARR['A'] = A_NAMES; ++ EMPTY_ELEMENT_ARR['b'] = B_NAMES; ++ EMPTY_ELEMENT_ARR['B'] = B_NAMES; ++ EMPTY_ELEMENT_ARR['c'] = C_NAMES; ++ EMPTY_ELEMENT_ARR['C'] = C_NAMES; ++ EMPTY_ELEMENT_ARR['e'] = E_NAMES; ++ EMPTY_ELEMENT_ARR['E'] = E_NAMES; ++ EMPTY_ELEMENT_ARR['f'] = F_NAMES; ++ EMPTY_ELEMENT_ARR['F'] = F_NAMES; ++ EMPTY_ELEMENT_ARR['h'] = H_NAMES; ++ EMPTY_ELEMENT_ARR['H'] = H_NAMES; ++ EMPTY_ELEMENT_ARR['i'] = I_NAMES; ++ EMPTY_ELEMENT_ARR['I'] = I_NAMES; ++ EMPTY_ELEMENT_ARR['l'] = L_NAMES; ++ EMPTY_ELEMENT_ARR['L'] = L_NAMES; ++ EMPTY_ELEMENT_ARR['m'] = M_NAMES; ++ EMPTY_ELEMENT_ARR['M'] = M_NAMES; ++ EMPTY_ELEMENT_ARR['p'] = P_NAMES; ++ EMPTY_ELEMENT_ARR['P'] = P_NAMES; ++ } ++ public HtmlResponseWriterImpl(Writer writer, String contentType, String characterEncoding) { this(writer,contentType,characterEncoding,true); @@@ -298,7 -298,7 +357,7 @@@ { if (_startTagOpen) { -- if (!_useStraightXml && S_EMPTY_HTML_ELEMENTS.contains(_startElementName.toLowerCase())) ++ if (!_useStraightXml && isEmptyElement(_startElementName)) { _currentWriter.write(" />"); // make null, this will cause NullPointer in some invalid element nestings @@@ -342,6 -342,6 +401,29 @@@ _startTagOpen = false; } } ++ ++ private boolean isEmptyElement(String elem) ++ { ++ // Code taken from trinidad ++ // =-=AEW Performance? Certainly slower to use a hashtable, ++ // at least if we can't assume the input name is lowercased. ++ // -= Leonardo Uribe =- elem.toLowerCase() internally creates an array, ++ // and the contains() force a call to hashCode(). The array uses simple ++ // char comparison, which at the end is faster and use less memory. ++ // Note this call is very frequent, so at the end it is worth to do it. ++ String[] array = EMPTY_ELEMENT_ARR[elem.charAt(0)]; ++ if (array != null) ++ { ++ for (int i = array.length - 1; i >= 0; i--) ++ { ++ if (elem.equalsIgnoreCase(array[i])) ++ { ++ return true; ++ } ++ } ++ } ++ return false; ++ } private void resetStartedElement() { @@@ -396,7 -396,7 +478,7 @@@ } else { -- if (!_useStraightXml && S_EMPTY_HTML_ELEMENTS.contains(name.toLowerCase())) ++ if (!_useStraightXml && isEmptyElement(name)) { /* Should this be here? It warns even when you have an x:htmlTag value="br", it should just close. -- To stop receiving notification emails like this one, please contact deki@apache.org.