You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/04/29 00:14:27 UTC

svn commit: r1097639 - in /myfaces/core/branches/2.1.x/impl/src: main/java/org/apache/myfaces/el/unified/resolver/ main/java/org/apache/myfaces/view/facelets/el/ main/java/org/apache/myfaces/view/facelets/tag/ test/java/org/apache/myfaces/view/facelets...

Author: lu4242
Date: Thu Apr 28 22:14:26 2011
New Revision: 1097639

URL: http://svn.apache.org/viewvc?rev=1097639&view=rev
Log:
MYFACES-3110 Allow use the same library for a composite component for resources defined inside it (resolve #{resource['this:...']} )

Added:
    myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceELUtils.java
    myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceLocationValueExpression.java
    myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceLocationValueExpressionUEL.java
    myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/logo_mini.jpg   (with props)
    myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/simpleThisResourceReference.xhtml
    myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testSimpleThisResourceReference.xhtml
Modified:
    myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java
    myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java
    myfaces/core/branches/2.1.x/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java
    myfaces/core/branches/2.1.x/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentTestCase.java

Modified: myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java?rev=1097639&r1=1097638&r2=1097639&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java (original)
+++ myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java Thu Apr 28 22:14:26 2011
@@ -26,6 +26,12 @@ import javax.el.ELException;
 import javax.el.ELResolver;
 import javax.faces.application.Resource;
 import javax.faces.application.ResourceHandler;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.view.Location;
+
+import org.apache.myfaces.view.facelets.el.CompositeComponentELUtils;
+import org.apache.myfaces.view.facelets.el.ResourceELUtils;
 
 /**
  * See JSF 2.0 spec section 5.6.1.3 and 5.6.2.4
@@ -36,6 +42,8 @@ import javax.faces.application.ResourceH
 public final class ResourceResolver extends ELResolver
 {
 
+    private static final String CC_LIBRARY_THIS = "this";
+    
     /** Creates a new instance of ResourceBundleResolver */
     public ResourceResolver()
     {
@@ -89,8 +97,19 @@ public final class ResourceResolver exte
                 else {
                     // Otherwise, portion before the ":" is the library name.
                     
+                    String libraryName = reference.substring (0, colonIndex);
+                    
+                    if (CC_LIBRARY_THIS.equals(libraryName))
+                    {
+                        FacesContext facesContext = facesContext(context);
+                        Location location = ResourceELUtils.getResourceLocationForResolver(facesContext);
+                        UIComponent cc = CompositeComponentELUtils.getCompositeComponentBasedOnLocation(facesContext, location);
+                        Resource ccResource = (Resource) cc.getAttributes().get(Resource.COMPONENT_RESOURCE_KEY); 
+                        libraryName = ccResource.getLibraryName();
+                    }
+                    
                     resource = ((ResourceHandler) base).createResource
-                        ( reference.substring(colonIndex + 1), reference.substring (0, colonIndex));
+                        ( reference.substring(colonIndex + 1), libraryName);
                 }
             }
             
@@ -102,6 +121,12 @@ public final class ResourceResolver exte
         }
         return null;
     }
+    
+    // get the FacesContext from the ELContext
+    private static FacesContext facesContext(final ELContext context)
+    {
+        return (FacesContext)context.getContext(FacesContext.class);
+    }
 
     @Override
     public boolean isReadOnly(final ELContext context, final Object base,

Added: myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceELUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceELUtils.java?rev=1097639&view=auto
==============================================================================
--- myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceELUtils.java (added)
+++ myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceELUtils.java Thu Apr 28 22:14:26 2011
@@ -0,0 +1,67 @@
+/*
+ * 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.view.facelets.el;
+
+import java.util.regex.Pattern;
+
+import javax.faces.context.FacesContext;
+import javax.faces.view.Location;
+
+/**
+ * Utility class when used in EL Expressions --> #{resource}
+ * 
+ * @author Leonardo Uribe
+ */
+public class ResourceELUtils {
+
+    // TODO: check this expression, maybe we can make it simpler, because "resource" implicit object
+    // cannot be preceded by anything.
+    public static final Pattern RESOURCE_EXPRESSION_REGEX = Pattern.compile(".*[^\\w\\.]resource[^\\w].*");
+    
+    private static final String RESOURCE = "resource";
+    
+    public static final String RESOURCE_LOCATION_KEY = "org.apache.myfaces.view.facelets.resource.location";
+    
+    public static boolean isResourceExpression(String expression)
+    {
+        if (expression.contains(RESOURCE))
+        {
+            return RESOURCE_EXPRESSION_REGEX.matcher(expression).matches();
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    public static Location getResourceLocationForResolver(FacesContext facesContext)
+    {
+        return (Location) facesContext.getAttributes().get(RESOURCE_LOCATION_KEY);
+    }
+    
+    public static void saveResourceLocationForResolver(FacesContext facesContext, Location location)
+    {
+        facesContext.getAttributes().put(RESOURCE_LOCATION_KEY, location);
+    }
+    
+    public static void removeResourceLocationForResolver(FacesContext facesContext)
+    {
+        facesContext.getAttributes().remove(RESOURCE_LOCATION_KEY);
+    }
+}

Added: myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceLocationValueExpression.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceLocationValueExpression.java?rev=1097639&view=auto
==============================================================================
--- myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceLocationValueExpression.java (added)
+++ myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceLocationValueExpression.java Thu Apr 28 22:14:26 2011
@@ -0,0 +1,129 @@
+/*
+ * 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.view.facelets.el;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.faces.FacesWrapper;
+import javax.faces.context.FacesContext;
+import javax.faces.view.Location;
+
+/**
+ * 
+ * @author Leonardo Uribe 
+ */
+public class ResourceLocationValueExpression extends LocationValueExpression implements FacesWrapper<ValueExpression>
+{
+    
+    private static final long serialVersionUID = -5636849184764526288L;
+    
+    public ResourceLocationValueExpression(Location location, ValueExpression delegate)
+    {
+        super(location, delegate);
+    }
+    
+    @Override
+    public Class<?> getType(ELContext context)
+    {
+        FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
+        ResourceELUtils.saveResourceLocationForResolver(facesContext, location);
+        try
+        {
+            return delegate.getType(context);
+        }
+        finally
+        {
+            ResourceELUtils.removeResourceLocationForResolver(facesContext);
+        }
+    }
+
+    @Override
+    public Object getValue(ELContext context)
+    {
+        FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
+        ResourceELUtils.saveResourceLocationForResolver(facesContext, location);
+        try
+        {
+            return delegate.getValue(context);
+        }
+        finally
+        {
+            ResourceELUtils.removeResourceLocationForResolver(facesContext);
+        }
+    }
+
+    @Override
+    public boolean isReadOnly(ELContext context)
+    {
+        FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
+        ResourceELUtils.saveResourceLocationForResolver(facesContext, location);
+        try
+        {
+            return delegate.isReadOnly(context);
+        }
+        finally
+        {
+            ResourceELUtils.removeResourceLocationForResolver(facesContext);
+        }
+    }
+
+    @Override
+    public void setValue(ELContext context, Object value)
+    {
+        FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
+        ResourceELUtils.saveResourceLocationForResolver(facesContext, location);
+        try
+        {
+            delegate.setValue(context, value);
+        }
+        finally
+        {
+            ResourceELUtils.removeResourceLocationForResolver(facesContext);
+        }
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        return delegate.equals(obj);
+    }
+
+    @Override
+    public String getExpressionString()
+    {
+        return delegate.getExpressionString();
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return delegate.hashCode();
+    }
+
+    @Override
+    public boolean isLiteralText()
+    {
+        return delegate.isLiteralText();
+    }
+
+    public ValueExpression getWrapped()
+    {
+        return delegate;
+    }
+}

Added: myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceLocationValueExpressionUEL.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceLocationValueExpressionUEL.java?rev=1097639&view=auto
==============================================================================
--- myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceLocationValueExpressionUEL.java (added)
+++ myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/el/ResourceLocationValueExpressionUEL.java Thu Apr 28 22:14:26 2011
@@ -0,0 +1,58 @@
+/*
+ * 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.view.facelets.el;
+
+import javax.el.ELContext;
+import javax.el.ValueExpression;
+import javax.el.ValueReference;
+import javax.faces.context.FacesContext;
+import javax.faces.view.Location;
+
+/**
+ * ResourceLocationValueExpression for el-api 2.2
+ * 
+ * @author Leonardo Uribe
+ * 
+ */
+public class ResourceLocationValueExpressionUEL extends ResourceLocationValueExpression
+{
+
+    private static final long serialVersionUID = 1824869909994211424L;
+
+    public ResourceLocationValueExpressionUEL(Location location, ValueExpression delegate)
+    {
+        super(location, delegate);
+    }
+    
+    @Override
+    public ValueReference getValueReference(ELContext context)
+    {
+        FacesContext facesContext = (FacesContext) context.getContext(FacesContext.class);
+        ResourceELUtils.saveResourceLocationForResolver(facesContext, location);
+        try
+        {
+            return delegate.getValueReference(context);
+        }
+        finally
+        {
+            ResourceELUtils.removeResourceLocationForResolver(facesContext);
+        }
+    }
+
+}

Modified: myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java?rev=1097639&r1=1097638&r2=1097639&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java (original)
+++ myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/tag/TagAttributeImpl.java Thu Apr 28 22:14:26 2011
@@ -33,6 +33,9 @@ import org.apache.myfaces.view.facelets.
 import org.apache.myfaces.view.facelets.el.LocationMethodExpression;
 import org.apache.myfaces.view.facelets.el.LocationValueExpression;
 import org.apache.myfaces.view.facelets.el.LocationValueExpressionUEL;
+import org.apache.myfaces.view.facelets.el.ResourceELUtils;
+import org.apache.myfaces.view.facelets.el.ResourceLocationValueExpression;
+import org.apache.myfaces.view.facelets.el.ResourceLocationValueExpressionUEL;
 import org.apache.myfaces.view.facelets.el.TagMethodExpression;
 import org.apache.myfaces.view.facelets.el.TagValueExpression;
 import org.apache.myfaces.view.facelets.el.TagValueExpressionUEL;
@@ -53,6 +56,8 @@ public final class TagAttributeImpl exte
     
     private final static int EL_CC_ATTR_ME = 4;
     
+    private final static int EL_RESOURCE = 8;
+    
     private final int capabilities;
 
     private final String localName;
@@ -72,6 +77,7 @@ public final class TagAttributeImpl exte
         boolean literal;
         boolean compositeComponentExpression;
         boolean compositeComponentAttrMethodExpression;
+        boolean resourceExpression;
         this.location = location;
         this.namespace = ns;
         this.localName = localName;
@@ -93,8 +99,10 @@ public final class TagAttributeImpl exte
         compositeComponentAttrMethodExpression = compositeComponentExpression ? 
                 CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(this.value) : 
                     false;
+        resourceExpression = !literal ? ResourceELUtils.isResourceExpression(this.value) : false;
 
-        this.capabilities = (literal ? EL_LITERAL : 0) | (compositeComponentExpression ? EL_CC : 0) | (compositeComponentAttrMethodExpression ? EL_CC_ATTR_ME : 0); 
+        this.capabilities = (literal ? EL_LITERAL : 0) | (compositeComponentExpression ? EL_CC : 0) | 
+            (compositeComponentAttrMethodExpression ? EL_CC_ATTR_ME : 0) | ( resourceExpression ? EL_RESOURCE : 0); 
     }
 
     /**
@@ -382,6 +390,17 @@ public final class TagAttributeImpl exte
                     valueExpression = new LocationValueExpression(getLocation(), valueExpression);
                 }
             }
+            else if ((this.capabilities & EL_RESOURCE) != 0)
+            {
+                if (ExternalSpecifications.isUnifiedELAvailable())
+                {
+                    valueExpression = new ResourceLocationValueExpressionUEL(getLocation(), valueExpression);
+                }
+                else
+                {
+                    valueExpression = new ResourceLocationValueExpression(getLocation(), valueExpression);
+                }
+            }
             
             return valueExpression;
         }

Modified: myfaces/core/branches/2.1.x/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java?rev=1097639&r1=1097638&r2=1097639&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java (original)
+++ myfaces/core/branches/2.1.x/impl/src/test/java/org/apache/myfaces/view/facelets/FaceletTestCase.java Thu Apr 28 22:14:26 2011
@@ -158,10 +158,13 @@ public abstract class FaceletTestCase ex
     {
         super.setUpExternalContext();
         
-        RuntimeConfig.getCurrentInstance(externalContext).setPropertyResolver(
-                new MockPropertyResolver());
-        RuntimeConfig.getCurrentInstance(externalContext).setVariableResolver(
-                new MockVariableResolver());
+        // Note if MyFaces ApplicationImpl instance is used (see on setFactories method),
+        // the ELResolver hierarchy will be set on ApplicationImpl.getELResolver() method
+        //RuntimeConfig.getCurrentInstance(externalContext).setPropertyResolver(
+        //        new MockPropertyResolver());
+        //RuntimeConfig.getCurrentInstance(externalContext).setVariableResolver(
+        //        new MockVariableResolver());
+        
         RuntimeConfig.getCurrentInstance(externalContext).setExpressionFactory(
                 new MockExpressionFactory());
     }

Modified: myfaces/core/branches/2.1.x/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentTestCase.java?rev=1097639&r1=1097638&r2=1097639&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentTestCase.java (original)
+++ myfaces/core/branches/2.1.x/impl/src/test/java/org/apache/myfaces/view/facelets/tag/composite/CompositeComponentTestCase.java Thu Apr 28 22:14:26 2011
@@ -23,6 +23,7 @@ import java.io.StringWriter;
 
 import javax.el.MethodExpression;
 import javax.el.ValueExpression;
+import javax.faces.application.Resource;
 import javax.faces.component.UICommand;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIInput;
@@ -30,6 +31,7 @@ import javax.faces.component.UINamingCon
 import javax.faces.component.UIOutput;
 import javax.faces.component.UIViewRoot;
 import javax.faces.component.html.HtmlCommandLink;
+import javax.faces.component.html.HtmlGraphicImage;
 import javax.faces.component.html.HtmlOutputText;
 
 import org.apache.myfaces.test.mock.MockResponseWriter;
@@ -636,4 +638,31 @@ public class CompositeComponentTestCase 
         Assert.assertTrue(resp.contains("WORLD"));
         
     }
+    
+    @Test
+    public void testSimpleThisResourceReference() throws Exception
+    {
+        UIViewRoot root = facesContext.getViewRoot();
+        vdl.buildView(facesContext, root, "testSimpleThisResourceReference.xhtml");
+
+        UINamingContainer compositeComponent = (UINamingContainer) root.findComponent("cc1");
+        Assert.assertNotNull(compositeComponent);
+        HtmlGraphicImage gi = (HtmlGraphicImage) compositeComponent.getFacet(UIComponent.COMPOSITE_FACET_NAME).findComponent("gi");
+        Assert.assertNotNull(gi);
+        
+        StringWriter sw = new StringWriter();
+        MockResponseWriter mrw = new MockResponseWriter(sw);
+        facesContext.setResponseWriter(mrw);
+        
+        compositeComponent.encodeAll(facesContext);
+        sw.flush();
+
+        String result = sw.toString();
+        
+        Resource resource = facesContext.getApplication().getResourceHandler().createResource("logo_mini.jpg", "testComposite");
+        Assert.assertNotNull(resource);
+        
+        Assert.assertTrue(result.contains(resource.getRequestPath()));
+    }
+
 }

Added: myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/logo_mini.jpg
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/logo_mini.jpg?rev=1097639&view=auto
==============================================================================
Binary file - no diff available.

Propchange: myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/logo_mini.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/simpleThisResourceReference.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/simpleThisResourceReference.xhtml?rev=1097639&view=auto
==============================================================================
--- myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/simpleThisResourceReference.xhtml (added)
+++ myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/resources/testComposite/simpleThisResourceReference.xhtml Thu Apr 28 22:14:26 2011
@@ -0,0 +1,30 @@
+<!--
+ 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"
+	xmlns:h="http://java.sun.com/jsf/html"
+	xmlns:f="http://java.sun.com/jsf/core"
+	xmlns:composite="http://java.sun.com/jsf/composite">
+<head>
+</head>
+<body>
+<composite:interface>
+</composite:interface>
+<composite:implementation>
+	<h:graphicImage id="gi" value="#{resource['this:logo_mini.jpg']}" /> 
+</composite:implementation>
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testSimpleThisResourceReference.xhtml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testSimpleThisResourceReference.xhtml?rev=1097639&view=auto
==============================================================================
--- myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testSimpleThisResourceReference.xhtml (added)
+++ myfaces/core/branches/2.1.x/impl/src/test/resources/org/apache/myfaces/view/facelets/tag/composite/testSimpleThisResourceReference.xhtml Thu Apr 28 22:14:26 2011
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!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"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:composite="http://java.sun.com/jsf/composite"
+ xmlns:testComposite="http://java.sun.com/jsf/composite/testComposite"
+ >
+<h:head>
+</h:head>
+<h:body>
+ <testComposite:simpleThisResourceReference id="cc1"/>
+</h:body>
+</html>
\ No newline at end of file