You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by cj...@apache.org on 2009/08/03 17:11:50 UTC

svn commit: r800417 - in /myfaces/core/trunk/impl/src/main/java/org/apache/myfaces: config/annotation/AnnotationConfigurator.java el/unified/ResolverBuilderForFaces.java el/unified/resolver/ResourceResolver.java view/facelets/tag/jsf/html/HtmlLibrary.java

Author: cjhoward
Date: Mon Aug  3 15:11:49 2009
New Revision: 800417

URL: http://svn.apache.org/viewvc?rev=800417&view=rev
Log:
MYFACES-2302 - @ManagedBean fixes, HtmlLibrary fixes, ResourceResolver fixes

Modified:
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForFaces.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlLibrary.java

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java?rev=800417&r1=800416&r2=800417&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/annotation/AnnotationConfigurator.java Mon Aug  3 15:11:49 2009
@@ -792,7 +792,26 @@
             RuntimeConfig runtimeConfig = RuntimeConfig.getCurrentInstance(_externalContext);
             org.apache.myfaces.config.impl.digester.elements.ManagedBean mbc =
                 new org.apache.myfaces.config.impl.digester.elements.ManagedBean();
-            mbc.setName(bean.name());
+            String beanName = bean.name();
+            
+            if ((beanName == null) || beanName.equals ("")) {
+                int index;
+                
+                // Missing name attribute algorithm: take the unqualified name and make the
+                // first character lowercase.
+                
+                beanName = clazz.getName();
+                index = beanName.lastIndexOf (".");
+                
+                if (index != -1) {
+                    beanName = beanName.substring (index + 1);
+                }
+                
+                beanName = Character.toLowerCase (beanName.charAt (0)) +
+                    beanName.substring (1);
+            }
+            
+            mbc.setName(beanName);
             mbc.setBeanClass(clazz.getName());
             
             ApplicationScoped appScoped = (ApplicationScoped) clazz.getAnnotation(ApplicationScoped.class);

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForFaces.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForFaces.java?rev=800417&r1=800416&r2=800417&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForFaces.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/ResolverBuilderForFaces.java Mon Aug  3 15:11:49 2009
@@ -59,6 +59,7 @@
         //before MapELResolver. Better to put this one before
         elResolver.add(new FlashELResolver());
         elResolver.add(new ManagedBeanResolver());
+        elResolver.add(new ResourceResolver());
         elResolver.add(new ResourceBundleELResolver());
         elResolver.add(new ResourceBundleResolver());
         elResolver.add(new MapELResolver());
@@ -66,7 +67,6 @@
         elResolver.add(new ArrayELResolver());
         elResolver.add(new BeanELResolver());
         elResolver.add(new ScopedAttributeResolver());
-        elResolver.add(new ResourceResolver());
     }
 
 }

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java?rev=800417&r1=800416&r2=800417&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/el/unified/resolver/ResourceResolver.java Mon Aug  3 15:11:49 2009
@@ -71,29 +71,30 @@
             String reference = (String) property;
             int colonIndex = (reference).indexOf(':');
             Resource resource = null;
-            if (colonIndex < 0)
-            {
-                if (reference.indexOf(':', colonIndex + 1) < 0
-                        && colonIndex != 0
-                        && colonIndex + 1 < reference.length())
-                {
-                    resource = ((ResourceHandler) base).createResource(
-                            reference.substring(0, colonIndex - 1), reference
-                                    .substring(colonIndex + 1));
+            
+            if (colonIndex == -1) {
+                // No library name, just create as a simple resource.
+                
+                resource = ((ResourceHandler) base).createResource (reference);
+            }
+            
+            else {
+                if (reference.lastIndexOf (':') != colonIndex) {
+                    // Max of one ":" allowed, so throw an exception.
+                    
+                    throw new ELException ("Malformed resource reference found when " +
+                        "resolving " + property);
                 }
-                else
-                {
-                    throw new ELException(
-                            "Malformed resource reference found when resolving "
-                                    + property);
+                
+                else {
+                    // Otherwise, portion before the ":" is the library name.
+                    
+                    resource = ((ResourceHandler) base).createResource
+                        (reference.substring (0, colonIndex), reference.substring
+                        (colonIndex + 1));
                 }
             }
-            else
-            {
-                resource = ((ResourceHandler) base).createResource(reference);
-                context.setPropertyResolved(true);
-                return resource.getRequestPath();
-            }
+            
             if (resource != null)
             {
                 context.setPropertyResolved(true);

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlLibrary.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlLibrary.java?rev=800417&r1=800416&r2=800417&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlLibrary.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jsf/html/HtmlLibrary.java Mon Aug  3 15:11:49 2009
@@ -32,7 +32,9 @@
     public HtmlLibrary()
     {
         super(Namespace);
-
+        
+        this.addHtmlComponent ("body", "javax.faces.Output", "javax.faces.Head");
+        
         this.addHtmlComponent("column", "javax.faces.Column", null);
 
         this.addHtmlComponent("commandButton", "javax.faces.HtmlCommandButton", "javax.faces.Button");
@@ -44,7 +46,9 @@
         this.addHtmlComponent("form", "javax.faces.HtmlForm", "javax.faces.Form");
 
         this.addHtmlComponent("graphicImage", "javax.faces.HtmlGraphicImage", "javax.faces.Image");
-
+        
+        this.addHtmlComponent ("head", "javax.faces.Output", "javax.faces.Head");
+        
         this.addHtmlComponent("inputHidden", "javax.faces.HtmlInputHidden", "javax.faces.Hidden");
 
         this.addHtmlComponent("inputSecret", "javax.faces.HtmlInputSecret", "javax.faces.Secret");
@@ -62,7 +66,11 @@
         this.addHtmlComponent("outputLabel", "javax.faces.HtmlOutputLabel", "javax.faces.Label");
 
         this.addHtmlComponent("outputLink", "javax.faces.HtmlOutputLink", "javax.faces.Link");
-
+        
+        this.addHtmlComponent ("outputScript", "javax.faces.Output", "javax.faces.resource.Script");
+        
+        this.addHtmlComponent ("outputStylesheet", "javax.faces.Output", "javax.faces.resource.Stylesheet");
+        
         this.addHtmlComponent("outputText", "javax.faces.HtmlOutputText", "javax.faces.Text");
 
         this.addHtmlComponent("panelGrid", "javax.faces.HtmlPanelGrid", "javax.faces.Grid");