myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject svn commit: r1416883 - in /myfaces/extensions/scripting/trunk: extscript-bundles/pom.xml extscript-core-root/extscript-cdi/src/main/java/org/apache/myfaces/extensions/scripting/cdi/core/CDIThrowAwayClassloader.java extscript-core-root/pom.xml
Date Tue, 04 Dec 2012 11:08:50 GMT
Author: werpu
Date: Tue Dec  4 11:08:49 2012
New Revision: 1416883

URL: http://svn.apache.org/viewvc?rev=1416883&view=rev
Log:
fixing an issue with the combination of CDI and Managed beans

Modified:
    myfaces/extensions/scripting/trunk/extscript-bundles/pom.xml
    myfaces/extensions/scripting/trunk/extscript-core-root/extscript-cdi/src/main/java/org/apache/myfaces/extensions/scripting/cdi/core/CDIThrowAwayClassloader.java
    myfaces/extensions/scripting/trunk/extscript-core-root/pom.xml

Modified: myfaces/extensions/scripting/trunk/extscript-bundles/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-bundles/pom.xml?rev=1416883&r1=1416882&r2=1416883&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-bundles/pom.xml (original)
+++ myfaces/extensions/scripting/trunk/extscript-bundles/pom.xml Tue Dec  4 11:08:49 2012
@@ -47,9 +47,7 @@
 
     <modules>
         <module>extscript-myfaces20-bundle</module>
-        <!--
         <module>extscript-mojarra-bundle</module>
-        -->
     </modules>
 
 

Modified: myfaces/extensions/scripting/trunk/extscript-core-root/extscript-cdi/src/main/java/org/apache/myfaces/extensions/scripting/cdi/core/CDIThrowAwayClassloader.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/extscript-cdi/src/main/java/org/apache/myfaces/extensions/scripting/cdi/core/CDIThrowAwayClassloader.java?rev=1416883&r1=1416882&r2=1416883&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/extscript-cdi/src/main/java/org/apache/myfaces/extensions/scripting/cdi/core/CDIThrowAwayClassloader.java
(original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/extscript-cdi/src/main/java/org/apache/myfaces/extensions/scripting/cdi/core/CDIThrowAwayClassloader.java
Tue Dec  4 11:08:49 2012
@@ -21,9 +21,12 @@ package org.apache.myfaces.extensions.sc
 
 import org.apache.myfaces.extensions.scripting.core.api.WeavingContext;
 import org.apache.myfaces.extensions.scripting.core.engine.ThrowAwayClassloader;
+import org.apache.myfaces.extensions.scripting.core.monitor.ClassResource;
 
+import javax.inject.Named;
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.annotation.Annotation;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -56,7 +59,25 @@ public class CDIThrowAwayClassloader ext
     @Override
     public Class<?> loadClass(String className) throws ClassNotFoundException
     {
-        return _delegate.loadClass(className);
+        Class clazz = _delegate.loadClass(className);
+        ClassResource res = (ClassResource) WeavingContext.getInstance().getResource(className);
+        if(res == null) {
+            return clazz;
+        }
+        //TODO check if the resource is a cdi resource or a jsf resource
+        //and in case of a jsf resource keep it tainted
+        Annotation[] anns = clazz.getAnnotations();
+        boolean cdiAnnotation = false;
+        if(anns == null || anns.length == 0) {
+            cdiAnnotation = true;
+        } else {
+            for(Annotation ann: anns) {
+               cdiAnnotation = ann instanceof Named;
+               if(cdiAnnotation) break;
+            }
+        }
+        res.setTainted(!cdiAnnotation);
+        return clazz;
     }
 
     @Override

Modified: myfaces/extensions/scripting/trunk/extscript-core-root/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/extscript-core-root/pom.xml?rev=1416883&r1=1416882&r2=1416883&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/extscript-core-root/pom.xml (original)
+++ myfaces/extensions/scripting/trunk/extscript-core-root/pom.xml Tue Dec  4 11:08:49 2012
@@ -45,9 +45,7 @@
         <module>extscript-cdi</module>
         <module>extscript-spring</module>
         <module>extscript-myfaces</module>
-        <!--
         <module>extscript-mojarra</module>
-        -->
         <!--
         <module>extscript-weld</module>
         -->



Mime
View raw message