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 2012/11/06 19:33:44 UTC
svn commit: r1406265 [2/2] - in /myfaces/core/branches/2.2.x: ./ api/
api/src/main/java/javax/faces/component/
api/src/main/java/javax/faces/context/
api/src/main/java/javax/faces/lifecycle/
client-window-example/src/main/java/org/apache/myfaces/exampl...
Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/TextUnit.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/TextUnit.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/TextUnit.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/compiler/TextUnit.java Tue Nov 6 18:33:41 2012
@@ -62,6 +62,8 @@ final class TextUnit extends Compilation
private final boolean escapeInlineText;
+ private final boolean compressSpaces;
+
public TextUnit(String alias, String id)
{
this(alias,id,true);
@@ -69,6 +71,11 @@ final class TextUnit extends Compilation
public TextUnit(String alias, String id, boolean escapeInlineText)
{
+ this(alias,id,escapeInlineText,false);
+ }
+
+ public TextUnit(String alias, String id, boolean escapeInlineText, boolean compressSpaces)
+ {
this.alias = alias;
this.id = id;
this.buffer = new StringBuffer();
@@ -79,6 +86,7 @@ final class TextUnit extends Compilation
this.startTagOpen = false;
this.messages = new ArrayList<Object>(4);
this.escapeInlineText = escapeInlineText;
+ this.compressSpaces = compressSpaces;
}
public FaceletHandler createFaceletHandler()
@@ -129,23 +137,51 @@ final class TextUnit extends Compilation
}
if (s.length() > 0)
{
- ELText txt = ELText.parse(s);
- if (txt != null)
+ if (!compressSpaces)
{
- if (txt.isLiteral())
+ //Do it as usual.
+ ELText txt = ELText.parse(s);
+ if (txt != null)
{
- if (escapeInlineText)
+ if (txt.isLiteral())
{
- this.instructionBuffer.add(new LiteralTextInstruction(txt.toString()));
+ if (escapeInlineText)
+ {
+ this.instructionBuffer.add(new LiteralTextInstruction(txt.toString()));
+ }
+ else
+ {
+ this.instructionBuffer.add(new LiteralNonExcapedTextInstruction(txt.toString()));
+ }
}
else
{
- this.instructionBuffer.add(new LiteralNonExcapedTextInstruction(txt.toString()));
+ this.instructionBuffer.add(new TextInstruction(this.alias, txt ));
}
}
- else
+ }
+ else
+ {
+ // First check if the text contains EL before build something, and if contains
+ // an EL expression, compress it before build the ELText.
+ if (s != null && s.length() > 0)
{
- this.instructionBuffer.add(new TextInstruction(this.alias, txt));
+ if (ELText.isLiteral(s))
+ {
+ if (escapeInlineText)
+ {
+ this.instructionBuffer.add(new LiteralTextInstruction(s));
+ }
+ else
+ {
+ this.instructionBuffer.add(new LiteralNonExcapedTextInstruction(s));
+ }
+ }
+ else
+ {
+ s = compressELText(s);
+ this.instructionBuffer.add(new TextInstruction(this.alias, ELText.parse(s) ));
+ }
}
}
}
@@ -311,6 +347,13 @@ final class TextUnit extends Compilation
ELText txt = ELText.parse(s);
if (txt != null)
{
+ if (compressSpaces)
+ {
+ // Use the logic behind the instructions to remove unnecessary instructions
+ // containing only spaces, or recreating new ones containing only the necessary
+ // spaces.
+ size = compressSpaces(instructionBuffer, size);
+ }
Instruction[] instructions = (Instruction[]) this.instructionBuffer
.toArray(new Instruction[size]);
this.children.add(new UIInstructionHandler(this.alias, this.id, instructions, txt));
@@ -408,6 +451,192 @@ final class TextUnit extends Compilation
return s.substring(0, i + 1);
}*/
}
+
+ final static String compressELText(String text)
+ {
+ int firstCharLocation = getFirstTextCharLocationIgnoringSpacesTabsAndCarriageReturn(text);
+ int lastCharLocation = getLastTextCharLocationIgnoringSpacesTabsAndCarriageReturn(text);
+ if (firstCharLocation == 0 && lastCharLocation == text.length()-1)
+ {
+ return text;
+ }
+ else
+ {
+ if (lastCharLocation+1 < text.length())
+ {
+ lastCharLocation = lastCharLocation+1;
+ }
+ if (firstCharLocation == 0)
+ {
+ return text.substring(firstCharLocation, lastCharLocation+1);
+ }
+ else
+ {
+ return text.substring(0,1)+text.substring(firstCharLocation, lastCharLocation+1);
+ }
+ }
+ }
+
+ /*
+ final static ELText compressELText(ELText parsedText, String text)
+ {
+ int firstCharLocation = getFirstTextCharLocationIgnoringSpacesTabsAndCarriageReturn(text);
+ int lastCharLocation = getLastTextCharLocationIgnoringSpacesTabsAndCarriageReturn(text);
+ if (firstCharLocation == 0 && lastCharLocation == text.length()-1)
+ {
+ return parsedText;
+ }
+ else
+ {
+ if (lastCharLocation+1 < text.length())
+ {
+ lastCharLocation = lastCharLocation+1;
+ }
+ if (firstCharLocation == 0)
+ {
+ return ELText.parse(text.substring(firstCharLocation, lastCharLocation+1));
+ }
+ else
+ {
+ return ELText.parse(text.substring(0,1)+text.substring(firstCharLocation, lastCharLocation+1));
+ }
+ }
+ }
+ */
+
+ final static int compressSpaces(List<Instruction> instructionBuffer, int size)
+ {
+ boolean addleftspace = true;
+ boolean addrightspace = false;
+ for (int i = 0; i < size; i++)
+ {
+ Instruction ins = instructionBuffer.get(i);
+ if (i+1 == size)
+ {
+ addrightspace = true;
+ }
+ //boolean isNextStartExpression = i+1<size ?
+ // (this.instructions[i+1] instanceof StartElementInstruction) : false;
+ if (ins instanceof LiteralTextInstruction)
+ {
+ String text = ((LiteralTextInstruction)ins).getText();
+ int firstCharLocation = getFirstTextCharLocationIgnoringSpacesTabsAndCarriageReturn(text);
+ if (firstCharLocation == text.length() && text.length() > 1)
+ {
+ // All the instruction is space, replace with an instruction
+ // with only one space
+ if (addleftspace || addrightspace)
+ {
+ instructionBuffer.set(i, new LiteralTextInstruction(text.substring(0,1)));
+ }
+ else
+ {
+ instructionBuffer.remove(i);
+ i--;
+ size--;
+ }
+ }
+ else if (firstCharLocation > 0)
+ {
+ int lastCharLocation = getLastTextCharLocationIgnoringSpacesTabsAndCarriageReturn(text);
+ // If right space, increment in 1
+ if (lastCharLocation+1 < text.length())
+ {
+ lastCharLocation = lastCharLocation+1;
+ }
+ instructionBuffer.set(i, new LiteralTextInstruction(
+ text.substring(0,1)+text.substring(firstCharLocation, lastCharLocation+1)));
+ }
+ else
+ {
+ int lastCharLocation = getLastTextCharLocationIgnoringSpacesTabsAndCarriageReturn(text);
+ // If right space, increment in 1
+ if (lastCharLocation+1 < text.length())
+ {
+ lastCharLocation = lastCharLocation+1;
+ }
+ instructionBuffer.set(i, new LiteralTextInstruction(
+ text.substring(firstCharLocation, lastCharLocation+1)));
+ }
+ }
+ else if (ins instanceof LiteralNonExcapedTextInstruction)
+ {
+ String text = ((LiteralTextInstruction)ins).getText();
+ int firstCharLocation = getFirstTextCharLocationIgnoringSpacesTabsAndCarriageReturn(text);
+ if (firstCharLocation == text.length())
+ {
+ // All the instruction is space, replace with an instruction
+ // with only one space
+ if (addleftspace || addrightspace)
+ {
+ instructionBuffer.set(i, new LiteralNonExcapedTextInstruction(text.substring(0,1)));
+ }
+ else
+ {
+ instructionBuffer.remove(i);
+ i--;
+ size--;
+ }
+ }
+ else if (firstCharLocation > 1)
+ {
+ int lastCharLocation = getLastTextCharLocationIgnoringSpacesTabsAndCarriageReturn(text);
+ // If right space, increment in 1
+ if (lastCharLocation+1 < text.length())
+ {
+ lastCharLocation = lastCharLocation+1;
+ }
+ instructionBuffer.set(i, new LiteralNonExcapedTextInstruction(
+ text.substring(0,1)+text.substring(firstCharLocation, lastCharLocation+1)));
+ }
+ else
+ {
+ int lastCharLocation = getLastTextCharLocationIgnoringSpacesTabsAndCarriageReturn(text);
+ // If right space, increment in 1
+ if (lastCharLocation+1 < text.length())
+ {
+ lastCharLocation = lastCharLocation+1;
+ }
+ instructionBuffer.set(i, new LiteralNonExcapedTextInstruction(
+ text.substring(firstCharLocation, lastCharLocation+1)));
+ }
+ }
+ addleftspace = false;
+ }
+ return size;
+ }
+
+ private static int getFirstTextCharLocationIgnoringSpacesTabsAndCarriageReturn(String text)
+ {
+ for (int i = 0; i < text.length(); i++)
+ {
+ if (Character.isWhitespace(text.charAt(i)))
+ {
+ continue;
+ }
+ else
+ {
+ return i;
+ }
+ }
+ return text.length();
+ }
+
+ private static int getLastTextCharLocationIgnoringSpacesTabsAndCarriageReturn(String text)
+ {
+ for (int i = text.length()-1; i >= 0; i--)
+ {
+ if (Character.isWhitespace(text.charAt(i)))
+ {
+ continue;
+ }
+ else
+ {
+ return i;
+ }
+ }
+ return 0;
+ }
public String toString()
{
Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/CompositeComponentELUtils.java Tue Nov 6 18:33:41 2012
@@ -106,14 +106,6 @@ public final class CompositeComponentELU
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 +118,15 @@ public final class CompositeComponentELU
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,6 @@ public final class CompositeComponentELU
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 +278,14 @@ public final class CompositeComponentELU
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
Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ELText.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ELText.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ELText.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ELText.java Tue Nov 6 18:33:41 2012
@@ -443,8 +443,9 @@ public class ELText
*/
public static boolean isLiteral(String in)
{
- ELText txt = parse(in);
- return txt == null || txt.isLiteral();
+ //ELText txt = parse(in);
+ //return txt == null || txt.isLiteral();
+ return isLiteral(null, null, in);
}
/**
@@ -554,6 +555,46 @@ public class ELText
return new ELTextComposite(ta);
}
}
+
+ public static boolean isLiteral(ExpressionFactory fact, ELContext ctx, String in) throws ELException
+ {
+ char[] ca = in.toCharArray();
+ int i = 0;
+ char c = 0;
+ int len = ca.length;
+ int end = len - 1;
+ boolean esc = false;
+ int vlen = 0;
+
+ while (i < len)
+ {
+ c = ca[i];
+ if ('\\' == c)
+ {
+ esc = !esc;
+ if (esc && i < end && (ca[i + 1] == '$' || ca[i + 1] == '#'))
+ {
+ i++;
+ continue;
+ }
+ }
+ else if (!esc && ('$' == c || '#' == c))
+ {
+ if (i < end)
+ {
+ if ('{' == ca[i + 1])
+ {
+ vlen = findVarLength(ca, i);
+ //In this point we have at least 1 EL expression, so it is not literal
+ return false;
+ }
+ }
+ }
+ esc = false;
+ i++;
+ }
+ return true;
+ }
private static int findVarLength(char[] ca, int s) throws ELException
{
Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ValueExpressionMethodExpression.java Tue Nov 6 18:33:41 2012
@@ -59,19 +59,44 @@ public class ValueExpressionMethodExpres
@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 +109,23 @@ public class ValueExpressionMethodExpres
@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()
Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java Tue Nov 6 18:33:41 2012
@@ -217,7 +217,8 @@ public final class TagAttributeImpl exte
(type != null && type.equals(localCachedExpression[(i*3)])) ) &&
(Arrays.equals(paramTypes, (Class[]) localCachedExpression[(i*3)+1])) )
{
- if ((this.capabilities & EL_CC) != 0)
+ if ((this.capabilities & EL_CC) != 0 &&
+ localCachedExpression[(i*3)+2] instanceof LocationMethodExpression)
{
return ((LocationMethodExpression)localCachedExpression[(i*3)+2]).apply(
actx.getFaceletCompositionContext().getCompositeComponentLevel());
@@ -255,12 +256,30 @@ public final class TagAttributeImpl exte
ValueExpression valueExpr = this.getValueExpression(ctx, Object.class);
methodExpression = new ValueExpressionMethodExpression(valueExpr);
+
+ if (actx.getFaceletCompositionContext().isWrapTagExceptionsAsContextAware())
+ {
+ methodExpression = new ContextAwareTagMethodExpression(this, methodExpression);
+ }
+ else
+ {
+ methodExpression = new TagMethodExpression(this, methodExpression);
+ }
}
else
{
ExpressionFactory f = ctx.getExpressionFactory();
methodExpression = f.createMethodExpression(ctx, this.value, type, paramTypes);
-
+
+ if (actx.getFaceletCompositionContext().isWrapTagExceptionsAsContextAware())
+ {
+ methodExpression = new ContextAwareTagMethodExpression(this, methodExpression);
+ }
+ else
+ {
+ methodExpression = new TagMethodExpression(this, methodExpression);
+ }
+
// if the MethodExpression contains a reference to the current composite
// component, the Location also has to be stored in the MethodExpression
// to be able to resolve the right composite component (the one that was
@@ -273,14 +292,6 @@ public final class TagAttributeImpl exte
}
}
- if (actx.getFaceletCompositionContext().isWrapTagExceptionsAsContextAware())
- {
- methodExpression = new ContextAwareTagMethodExpression(this, methodExpression);
- }
- else
- {
- methodExpression = new TagMethodExpression(this, methodExpression);
- }
if (actx.isAllowCacheELExpressions() && !actx.isAnyFaceletsVariableResolved())
{
Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentBeanInfo.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentBeanInfo.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentBeanInfo.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentBeanInfo.java Tue Nov 6 18:33:41 2012
@@ -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 +75,8 @@ import javax.faces.view.AttachedObjectTa
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 +100,8 @@ public class CompositeComponentBeanInfo
private PropertyDescriptor[] _propertyDescriptorsArray;
+ private Map<String, PropertyDescriptor> _propertyDescriptorsMap;
+
/**
* Used for Serialization
*/
@@ -107,6 +114,7 @@ public class CompositeComponentBeanInfo
{
super();
_descriptor = descriptor;
+ getBeanDescriptor().setValue(PROPERTY_DESCRIPTOR_MAP_KEY, new PropertyDescriptorMap());
}
@Override
@@ -170,6 +178,7 @@ public class CompositeComponentBeanInfo
_descriptor.setName((String) in.readObject());
_descriptor.setPreferred(in.readBoolean());
_descriptor.setShortDescription((String) in.readObject());
+ _descriptor.setValue(PROPERTY_DESCRIPTOR_MAP_KEY, new PropertyDescriptorMap());
Map<String,Object> map = (Map) in.readObject();
@@ -200,7 +209,8 @@ public class CompositeComponentBeanInfo
// 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 +219,122 @@ public class CompositeComponentBeanInfo
out.writeObject(_propertyDescriptors);
}
+
+ public Map<String, PropertyDescriptor> 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<String, PropertyDescriptor>(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<String, PropertyDescriptor>
+ {
+
+ 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<? extends String, ? extends PropertyDescriptor> m)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public void clear()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Set<String> keySet()
+ {
+ return getPropertyDescriptorsMap().keySet();
+ }
+
+ public Collection<PropertyDescriptor> values()
+ {
+ return getPropertyDescriptorsMap().values();
+ }
+
+ public Set<Entry<String, PropertyDescriptor>> entrySet()
+ {
+ return getPropertyDescriptorsMap().entrySet();
+ }
+ }
}
Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentResourceTagHandler.java Tue Nov 6 18:33:41 2012
@@ -319,6 +319,8 @@ public class CompositeComponentResourceT
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
Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/ComponentSupport.java Tue Nov 6 18:33:41 2012
@@ -59,7 +59,14 @@ public final class ComponentSupport
* 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 +425,7 @@ public final class ComponentSupport
.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;
}
Modified: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ViewMetadataHandler.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ViewMetadataHandler.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ViewMetadataHandler.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/core/ViewMetadataHandler.java Tue Nov 6 18:33:41 2012
@@ -69,6 +69,7 @@ public final class ViewMetadataHandler e
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);
}
}
Propchange: myfaces/core/branches/2.2.x/impl/src/main/resources/META-INF/faces-config20.vm
------------------------------------------------------------------------------
Reverse-merged /myfaces/core/trunk_1.2.x/impl/src/main/resources/META-INF/faces-config12.vm:r693358-695050
Merged /myfaces/core/trunk/impl/src/main/resources/META-INF/faces-config20.vm:r1383166,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
Merged /myfaces/core/branches/2.1.x-client-window/impl/src/main/resources/META-INF/faces-config20.vm:r1396979-1406260
Modified: myfaces/core/branches/2.2.x/impl/src/main/resources/META-INF/xdoc-component.vm
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/resources/META-INF/xdoc-component.vm?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/resources/META-INF/xdoc-component.vm (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/resources/META-INF/xdoc-component.vm Tue Nov 6 18:33:41 2012
@@ -1,4 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
+#*
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*###
<document>
<properties>
<title><${component.name}></title>
Modified: myfaces/core/branches/2.2.x/impl/src/main/resources/META-INF/xdoc-tag.vm
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/resources/META-INF/xdoc-tag.vm?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/resources/META-INF/xdoc-tag.vm (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/resources/META-INF/xdoc-tag.vm Tue Nov 6 18:33:41 2012
@@ -1,4 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
+#*
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*###
<document>
<properties>
<title><${tag.name}></title>
Modified: myfaces/core/branches/2.2.x/impl/src/main/resources/META-INF/xdoc-web-config.vm
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/resources/META-INF/xdoc-web-config.vm?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/resources/META-INF/xdoc-web-config.vm (original)
+++ myfaces/core/branches/2.2.x/impl/src/main/resources/META-INF/xdoc-web-config.vm Tue Nov 6 18:33:41 2012
@@ -1,4 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
+#*
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*###
<document>
<properties>
<title>Web Context Parameters</title>
Modified: myfaces/core/branches/2.2.x/impl/src/test/java/org/apache/myfaces/config/annotation/ClassByteCodeAnnotationFilterTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/test/java/org/apache/myfaces/config/annotation/ClassByteCodeAnnotationFilterTest.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/test/java/org/apache/myfaces/config/annotation/ClassByteCodeAnnotationFilterTest.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/test/java/org/apache/myfaces/config/annotation/ClassByteCodeAnnotationFilterTest.java Tue Nov 6 18:33:41 2012
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.myfaces.config.annotation;
import java.io.DataInputStream;
Modified: myfaces/core/branches/2.2.x/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java (original)
+++ myfaces/core/branches/2.2.x/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java Tue Nov 6 18:33:41 2012
@@ -181,7 +181,14 @@ public class RestoreViewExecutorTest ext
*/
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();
}
/**
Modified: myfaces/core/branches/2.2.x/impl/src/test/resources/org/apache/myfaces/lifecycle/view1.jsp
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/test/resources/org/apache/myfaces/lifecycle/view1.jsp?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/test/resources/org/apache/myfaces/lifecycle/view1.jsp (original)
+++ myfaces/core/branches/2.2.x/impl/src/test/resources/org/apache/myfaces/lifecycle/view1.jsp Tue Nov 6 18:33:41 2012
@@ -1,3 +1,18 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id$
+-->
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Modified: myfaces/core/branches/2.2.x/impl/src/test/resources/org/apache/myfaces/lifecycle/view2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/test/resources/org/apache/myfaces/lifecycle/view2.xhtml?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/test/resources/org/apache/myfaces/lifecycle/view2.xhtml (original)
+++ myfaces/core/branches/2.2.x/impl/src/test/resources/org/apache/myfaces/lifecycle/view2.xhtml Tue Nov 6 18:33:41 2012
@@ -1,3 +1,18 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: defineInclude.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
Modified: myfaces/core/branches/2.2.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testSimpleThisResourceReference.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testSimpleThisResourceReference.xhtml?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testSimpleThisResourceReference.xhtml (original)
+++ myfaces/core/branches/2.2.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testSimpleThisResourceReference.xhtml Tue Nov 6 18:33:41 2012
@@ -1,4 +1,19 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: defineInclude.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
Modified: myfaces/core/branches/2.2.x/implee6/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/implee6/pom.xml?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/implee6/pom.xml (original)
+++ myfaces/core/branches/2.2.x/implee6/pom.xml Tue Nov 6 18:33:41 2012
@@ -16,7 +16,7 @@
* limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
+
<parent>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-core-project</artifactId>
@@ -41,6 +41,25 @@
<url>http://svn.apache.org/repos/asf/myfaces/core/trunk/implee6</url>
</scm>
+ <build>
+
+ <plugins>
+
+ <!-- license checker needs to exclude some kinds of files -->
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <!-- services files are trivial config files with no comments -->
+ <exclude>src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </build>
<dependencies>
Propchange: myfaces/core/branches/2.2.x/parent/pom.xml
------------------------------------------------------------------------------
Merged /myfaces/core/branches/2.1.x-client-window/parent/pom.xml:r1396979-1406260
Merged /myfaces/core/trunk/parent/pom.xml:r1383166,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
Propchange: myfaces/core/branches/2.2.x/parent/src/
------------------------------------------------------------------------------
Merged /myfaces/core/branches/2.1.x-client-window/parent/src:r1396979-1406260
Merged /myfaces/core/trunk/parent/src:r1383166,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
Propchange: myfaces/core/branches/2.2.x/shared/
------------------------------------------------------------------------------
Merged /myfaces/core/branches/2.1.x-client-window/shared:r1396979-1406260
Merged /myfaces/core/trunk/shared:r1383166,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
Propchange: myfaces/core/branches/2.2.x/shared-public/pom.xml
------------------------------------------------------------------------------
Merged /myfaces/core/branches/2.1.x-client-window/shared-public/pom.xml:r1396979-1406260
Merged /myfaces/core/trunk/shared-public/pom.xml:r1383166,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
Propchange: myfaces/core/branches/2.2.x/shared-public/src/
------------------------------------------------------------------------------
Merged /myfaces/core/branches/2.1.x-client-window/shared-public/src:r1396979-1406260
Merged /myfaces/core/trunk/shared-public/src:r1383166,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
Propchange: myfaces/core/branches/2.2.x/shared-public/src/main/java/org/apache/myfaces/shared/util/AttachedDeltaWrapper.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/AttachedDeltaWrapper.java:r1383166,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
Merged /myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/AttachedDeltaWrapper.java:r1396979-1406260
Propchange: myfaces/core/branches/2.2.x/shared-public/src/main/java/org/apache/myfaces/shared/util/ComponentUtils.java
------------------------------------------------------------------------------
Merged /myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/ComponentUtils.java:r1396979-1406260
Merged /myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/ComponentUtils.java:r1383166,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
Propchange: myfaces/core/branches/2.2.x/shared-public/src/main/java/org/apache/myfaces/shared/util/DebugUtils.java
------------------------------------------------------------------------------
Merged /myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/DebugUtils.java:r1396979-1406260
Merged /myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/DebugUtils.java:r1383166,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
Propchange: myfaces/core/branches/2.2.x/shared-public/src/main/java/org/apache/myfaces/shared/util/RendererUtils.java
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/RendererUtils.java:r1383166,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
Merged /myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/RendererUtils.java:r1396979-1406260
Propchange: myfaces/core/branches/2.2.x/shared-public/src/main/java/org/apache/myfaces/shared/util/TagUtils.java
------------------------------------------------------------------------------
Merged /myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/TagUtils.java:r1396979-1406260
Merged /myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/TagUtils.java:r1383166,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
Propchange: myfaces/core/branches/2.2.x/shared-public/src/main/java/org/apache/myfaces/shared/util/renderkit/
------------------------------------------------------------------------------
Merged /myfaces/core/trunk/shared-public/src/main/java/org/apache/myfaces/shared/util/renderkit:r1383166,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
Merged /myfaces/core/branches/2.1.x-client-window/shared-public/src/main/java/org/apache/myfaces/shared/util/renderkit:r1396979-1406260
Modified: myfaces/core/branches/2.2.x/shared-public/src/test/resources/org/apache/myfaces/shared/application/view1.jsp
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/shared-public/src/test/resources/org/apache/myfaces/shared/application/view1.jsp?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/shared-public/src/test/resources/org/apache/myfaces/shared/application/view1.jsp (original)
+++ myfaces/core/branches/2.2.x/shared-public/src/test/resources/org/apache/myfaces/shared/application/view1.jsp Tue Nov 6 18:33:41 2012
@@ -1,3 +1,18 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id$
+-->
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Modified: myfaces/core/branches/2.2.x/shared-public/src/test/resources/org/apache/myfaces/shared/application/view2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/shared-public/src/test/resources/org/apache/myfaces/shared/application/view2.xhtml?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/shared-public/src/test/resources/org/apache/myfaces/shared/application/view2.xhtml (original)
+++ myfaces/core/branches/2.2.x/shared-public/src/test/resources/org/apache/myfaces/shared/application/view2.xhtml Tue Nov 6 18:33:41 2012
@@ -1,3 +1,18 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: defineInclude.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
Modified: myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java (original)
+++ myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java Tue Nov 6 18:33:41 2012
@@ -79,6 +79,27 @@ public class DefaultViewHandlerSupport i
private volatile ConcurrentLRUCache<String, Boolean> _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 +204,7 @@ public class DefaultViewHandlerSupport i
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 +429,8 @@ public class DefaultViewHandlerSupport i
*/
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 +489,7 @@ public class DefaultViewHandlerSupport i
}
//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)
Modified: myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java (original)
+++ myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java Tue Nov 6 18:33:41 2012
@@ -220,7 +220,14 @@ public class HtmlCheckboxRendererBase ex
}
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)
Modified: myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java (original)
+++ myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java Tue Nov 6 18:33:41 2012
@@ -194,7 +194,14 @@ public class HtmlRadioRendererBase
}
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)
Modified: myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java (original)
+++ myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java Tue Nov 6 18:33:41 2012
@@ -21,8 +21,6 @@ package org.apache.myfaces.shared.render
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 +98,6 @@ public class HtmlResponseWriterImpl
private boolean _cdataOpen;
- private static final Set<String> S_EMPTY_HTML_ELEMENTS = new HashSet<String>();
-
private static final String CDATA_START = "<![CDATA[ \n";
private static final String CDATA_START_NO_LINE_RETURN = "<![CDATA[";
private static final String COMMENT_START = "<!--\n";
@@ -112,23 +108,86 @@ public class HtmlResponseWriterImpl
private static final String COMMENT_COMMENT_END = "\n//-->";
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 +357,7 @@ public class HtmlResponseWriterImpl
{
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 +401,29 @@ public class HtmlResponseWriterImpl
_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 +478,7 @@ public class HtmlResponseWriterImpl
}
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.
Modified: myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/util/MyFacesObjectInputStream.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/util/MyFacesObjectInputStream.java?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/util/MyFacesObjectInputStream.java (original)
+++ myfaces/core/branches/2.2.x/shared/src/main/java/org/apache/myfaces/shared/util/MyFacesObjectInputStream.java Tue Nov 6 18:33:41 2012
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;
+import java.lang.reflect.Proxy;
/**
* Tried to deploy v0.4.2 on JBoss 3.2.1 and had a classloading problem again.
@@ -53,4 +54,36 @@ public class MyFacesObjectInputStream
return super.resolveClass(desc);
}
}
+
+ protected Class resolveProxyClass(String[] interfaces)
+ throws IOException, ClassNotFoundException
+ {
+ // Only option that would match the current code would be to
+ // expand ClassLoaderExtension to handle 'getProxyClass', which
+ // would break all existing ClassLoaderExtension implementations
+ Class[] cinterfaces = new Class[interfaces.length];
+ for (int i = 0; i < interfaces.length; i++)
+ {
+ cinterfaces[i] = ClassUtils.classForName(interfaces[i]);
+ }
+
+ try
+ {
+ // Try WebApp ClassLoader first
+ return Proxy.getProxyClass(ClassUtils.getContextClassLoader(), cinterfaces);
+ }
+ catch (Exception ex)
+ {
+ // fallback: Try ClassLoader for MyFacesObjectInputStream (i.e. the myfaces.jar lib)
+ try
+ {
+ return Proxy.getProxyClass(
+ MyFacesObjectInputStream.class.getClassLoader(), cinterfaces);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new ClassNotFoundException(e.toString(), e);
+ }
+ }
+ }
}
Modified: myfaces/core/branches/2.2.x/shared/src/test/resources/org/apache/myfaces/shared/application/view1.jsp
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/shared/src/test/resources/org/apache/myfaces/shared/application/view1.jsp?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/shared/src/test/resources/org/apache/myfaces/shared/application/view1.jsp (original)
+++ myfaces/core/branches/2.2.x/shared/src/test/resources/org/apache/myfaces/shared/application/view1.jsp Tue Nov 6 18:33:41 2012
@@ -1,3 +1,18 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id$
+-->
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Modified: myfaces/core/branches/2.2.x/shared/src/test/resources/org/apache/myfaces/shared/application/view2.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/shared/src/test/resources/org/apache/myfaces/shared/application/view2.xhtml?rev=1406265&r1=1406264&r2=1406265&view=diff
==============================================================================
--- myfaces/core/branches/2.2.x/shared/src/test/resources/org/apache/myfaces/shared/application/view2.xhtml (original)
+++ myfaces/core/branches/2.2.x/shared/src/test/resources/org/apache/myfaces/shared/application/view2.xhtml Tue Nov 6 18:33:41 2012
@@ -1,3 +1,18 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: defineInclude.xml 804043 2009-08-13 22:08:44Z lu4242 $
+-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>