myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From we...@apache.org
Subject svn commit: r911372 - in /myfaces/extensions/scripting/trunk: core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/ core/core/src/main/java/org/apache/myfaces/scripting/refresh/ core/myfaces12-extensions/src/main/java/org/apache/myf...
Date Thu, 18 Feb 2010 12:56:00 GMT
Author: werpu
Date: Thu Feb 18 12:55:59 2010
New Revision: 911372

URL: http://svn.apache.org/viewvc?rev=911372&view=rev
Log:
EXTSCRIPT-62 - Dependency detection - interfaces not entirely correctly detected

Added:
    myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BaseInterface.java
  (with props)
Modified:
    myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/ClassScanVisitor.java
    myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/DefaultDependencyScanner.java
    myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/refresh/FileChangedDaemon.java
    myfaces/extensions/scripting/trunk/core/myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java
    myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
    myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java
    myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestValidator.groovy
    myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/WEB-INF/web.xml
    myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/helloWorld.xhtml
    myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/Blog.java
    myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BlogServiceInterface.java
    myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/validatorConverterTest/TestConverter1.java
    myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/validatorConverterTest/TestValidator2.java
    myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/helloWorld.xhtml

Modified: myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/ClassScanVisitor.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/ClassScanVisitor.java?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/ClassScanVisitor.java
(original)
+++ myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/ClassScanVisitor.java
Thu Feb 18 12:55:59 2010
@@ -20,6 +20,7 @@
 
 import org.objectweb.asm.*;
 
+import java.util.Arrays;
 import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -52,6 +53,11 @@
         //log.log(Level.INFO, "{0} extends {1} ", new String[]{name, superName});
 
         ClassScanUtils.logParmList(dependencies, whiteList, superName);
+        if(interfaces != null && interfaces.length > 0) {
+            for(String currInterface: interfaces) {
+                ClassScanUtils.logParmList(dependencies, whiteList, currInterface);
+            }
+        }
     }
 
     public void visitSource(String source, String debug) {

Modified: myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/DefaultDependencyScanner.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/DefaultDependencyScanner.java?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/DefaultDependencyScanner.java
(original)
+++ myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/core/dependencyScan/DefaultDependencyScanner.java
Thu Feb 18 12:55:59 2010
@@ -75,15 +75,33 @@
                 return;
             }
             scanCurrentClass(loader, retVal, className, whiteList);
-            scanHierarchy(loader, retVal, whiteList, toCheck);
-
-            //TODO now lets do the same for the interfaces and their parents
+            scanHierarchy(loader, retVal, whiteList, toCheck, true);
 
         } catch (ClassNotFoundException e) {
             log.error("DefaultDependencyScanner.investigateInheritanceHierarchy()" + e);
         }
     }
 
+    private void scanInterfaces(ClassLoader loader, Set<String> retVal, Set<String>
whiteList, Class toCheck) {
+        Class[] interfaces = toCheck.getInterfaces();
+        if (interfaces == null || interfaces.length == 0) {
+            return;
+        }
+
+        for (Class currentInterface : interfaces) {
+            if (ClassScanUtils.isStandardNamespace(currentInterface.getName())) {
+                continue;
+            }
+            scanCurrentClass(loader, retVal, currentInterface.getName(), whiteList);
+
+            //We scan also our parent interfaces to get a full coverage
+            //but since interfaces do not implement anything we can cover
+            //the parents
+            scanHierarchy(loader, retVal, whiteList, currentInterface, false);
+        }
+
+    }
+
     /**
      * scans the hierarchy of a given class
      *
@@ -92,12 +110,21 @@
      * @param whiteList
      * @param toCheck
      */
-    private void scanHierarchy(ClassLoader loader, Set<String> retVal, Set<String>
whiteList, Class toCheck) {
+    private void scanHierarchy(ClassLoader loader, Set<String> retVal, Set<String>
whiteList, Class toCheck, boolean interfaceCheck) {
         Class parent = toCheck.getSuperclass();
 
         while (parent != null && !ClassScanUtils.isStandardNamespace(parent.getName()))
{
+            if (interfaceCheck) {
+                //we recursively descend into our interfaces, it should not
+                //get any cyclic calls the tainting mechanism should prevent that
+                //and also the descension into parents, determinism should be
+                //enabled by both measures
+                scanInterfaces(loader, retVal, whiteList, parent);
+            }
+
             scanCurrentClass(loader, retVal, parent.getName(), whiteList);
             parent = parent.getSuperclass();
+
         }
     }
 

Modified: myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/refresh/FileChangedDaemon.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/refresh/FileChangedDaemon.java?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/refresh/FileChangedDaemon.java
(original)
+++ myfaces/extensions/scripting/trunk/core/core/src/main/java/org/apache/myfaces/scripting/refresh/FileChangedDaemon.java
Thu Feb 18 12:55:59 2010
@@ -99,8 +99,8 @@
 
                 if (classMap == null || classMap.size() == 0)
                     continue;
-
-                checkForChanges();
+                 if(contextInitialized)
+                    checkForChanges();
             } catch (Throwable e) {
                 log.error(e.getMessage());
             }

Modified: myfaces/extensions/scripting/trunk/core/myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java
(original)
+++ myfaces/extensions/scripting/trunk/core/myfaces12-extensions/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java
Thu Feb 18 12:55:59 2010
@@ -86,6 +86,7 @@
     private void initRefreshContext(ServletContext servletContext) {
         RefreshContext rContext = new RefreshContext();
         servletContext.setAttribute("RefreshContext", rContext);
+        rContext.getDaemon().initWeavingContext(servletContext);
         WeavingContext.setRefreshContext(rContext);
     }
 

Modified: myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
(original)
+++ myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/jsf/dynamicdecorators/implemetations/ApplicationProxy.java
Thu Feb 18 12:55:59 2010
@@ -435,7 +435,7 @@
         //the validators are recreated every request we do not have to deal with them on
method level
         Validator newRetVal = (Validator) reloadInstance(retVal, ScriptingConst.ARTIFACT_TYPE_VALIDATOR);
         if (newRetVal != retVal) {
-            return _delegate.createValidator(validatorId);
+            _delegate.createValidator(validatorId);
         }
         return retVal;
     }

Modified: myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java
(original)
+++ myfaces/extensions/scripting/trunk/core/myfaces2-extensions/src/main/java/org/apache/myfaces/scripting/servlet/StartupServletContextPluginChainLoader.java
Thu Feb 18 12:55:59 2010
@@ -85,6 +85,7 @@
     private void initRefreshContext(ServletContext servletContext) {
         RefreshContext rContext = new RefreshContext();
         servletContext.setAttribute("RefreshContext", rContext);
+        rContext.getDaemon().initWeavingContext(servletContext);
         WeavingContext.setRefreshContext(rContext);
     }
 

Modified: myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestValidator.groovy
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestValidator.groovy?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestValidator.groovy
(original)
+++ myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/WEB-INF/groovy/org/apache/myfaces/groovyloader/test/TestValidator.groovy
Thu Feb 18 12:55:59 2010
@@ -21,6 +21,9 @@
 import javax.faces.validator.Validator
 import javax.faces.context.FacesContext
 import javax.faces.component.UIComponent
+import javax.faces.FacesException
+import javax.faces.application.FacesMessage
+import javax.faces.validator.ValidatorException
 
 /**
  * @author Werner Punz
@@ -28,6 +31,10 @@
 class TestValidator implements Validator {
 
   public void validate(FacesContext facesContext, UIComponent uiComponent, Object o) {
+    if(!((String)o).equals("hello world")) {
+      print ("error found")
+      throw new ValidatorException (new FacesMessage("Validation failed for field please
input hello world"))
+    }
     println "validating testvalidation  "
   }
 

Modified: myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/WEB-INF/web.xml?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/WEB-INF/web.xml
(original)
+++ myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/WEB-INF/web.xml
Thu Feb 18 12:55:59 2010
@@ -44,7 +44,6 @@
         <param-name>org.apache.myfaces.FACES_INIT_PLUGINS</param-name>
         <param-value>org.apache.myfaces.scripting.servlet.StartupServletContextPluginChainLoader</param-value>
     </context-param>
-
     <!--
     <context-param>
         <description>Additional comma separated loader paths to allow direct editing
on the sources directory instead
@@ -82,8 +81,7 @@
          <param-name>facelets.RESOURCE_RESOLVER</param-name>
          <param-value>org.apache.myfaces.scripting.facelet.ReroutingResourceResolver</param-value>
      </context-param>
-     -->
-
+    -->
     <!--
     <context-param>
         <description>Additional comma separated loader paths to allow direct editing
on the sources directory instead

Modified: myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/helloWorld.xhtml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/helloWorld.xhtml?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/helloWorld.xhtml
(original)
+++ myfaces/extensions/scripting/trunk/examples/myfaces12-example/src/main/webapp/helloWorld.xhtml
Thu Feb 18 12:55:59 2010
@@ -11,8 +11,12 @@
 
     <ui:define name="body">
         <h:form id="form">
+
+
+
             <h:panelGroup styleClass="left">
                 <h:panelGroup styleClass="stdBox">
+                    <h:messages />
                     <h3>Validator Test 1</h3>
                     <h:outputText id="output1" value="Please enter your name"/>
                     <h:inputText id="input1" value="#{helloWorld.name}" required="true">

Modified: myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml
(original)
+++ myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/faces-config.xml
Thu Feb 18 12:55:59 2010
@@ -37,13 +37,11 @@
         <managed-bean-scope>request</managed-bean-scope>
     </managed-bean>
 
-    <!--
         <managed-bean>
             <managed-bean-name>javatestbean</managed-bean-name>
             <managed-bean-class>org.apache.myfaces.javaloader.test.TestBean2</managed-bean-class>
             <managed-bean-scope>request</managed-bean-scope>
         </managed-bean>
-    -->
 
 
     <managed-bean>
@@ -59,24 +57,20 @@
     </managed-bean>
 
     <application>
-        <!--
         <navigation-handler>
             org.apache.myfaces.groovyloader.test.TestNavigationHandler
         </navigation-handler>
-        -->
         <resource-handler>
             org.apache.myfaces.scripting.jsf2.resources.SourceResourceHandler
         </resource-handler>
 
     </application>
 
-    <!--
     <lifecycle>
         <phase-listener>
             org.apache.myfaces.groovyloader.test.TestPhaseListener
         </phase-listener>
     </lifecycle>
-    -->
 
     <!-- navigation rules for helloWorld.jsp -->
     <navigation-rule>
@@ -96,7 +90,6 @@
         </navigation-case>
     </navigation-rule>
 
-    <!--
     <validator>
         <validator-id>org.apache.myfaces.groovyloader.test.TestValidator</validator-id>
         <validator-class>org.apache.myfaces.groovyloader.test.TestValidator</validator-class>
@@ -118,5 +111,4 @@
             <renderer-class>org.apache.myfaces.groovyloader.test.TestRenderer</renderer-class>
         </renderer>
     </render-kit>
-     -->
 </faces-config>
\ No newline at end of file

Added: myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BaseInterface.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BaseInterface.java?rev=911372&view=auto
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BaseInterface.java
(added)
+++ myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BaseInterface.java
Thu Feb 18 12:55:59 2010
@@ -0,0 +1,8 @@
+package org.apache.myfaces.javaloader.blog;
+
+/**
+ * Base interface to test inheritance detection
+ */
+public interface BaseInterface {
+    
+}

Propchange: myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BaseInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BaseInterface.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/Blog.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/Blog.java?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/Blog.java
(original)
+++ myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/Blog.java
Thu Feb 18 12:55:59 2010
@@ -31,7 +31,7 @@
 @DependencyTestAnnotation
 public class Blog {
 
-    String title = "Hello to the myfaces dynamic blogging example";
+    String title = "Hello to the MyFaces dynamic blogging example";
     String title1 = "You can alter the code for this small blogging application on the fly,
" +
             "you even can add new classes on the fly and Java will pick it up";
 

Modified: myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BlogServiceInterface.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BlogServiceInterface.java?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BlogServiceInterface.java
(original)
+++ myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/blog/BlogServiceInterface.java
Thu Feb 18 12:55:59 2010
@@ -21,7 +21,8 @@
 /**
  * Test for indirect dependency over interfaces
  */
-public interface BlogServiceInterface {
+public interface BlogServiceInterface extends BaseInterface {
+    
     public void addEntry(BlogEntry entry);
 
 }

Modified: myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/validatorConverterTest/TestConverter1.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/validatorConverterTest/TestConverter1.java?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/validatorConverterTest/TestConverter1.java
(original)
+++ myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/validatorConverterTest/TestConverter1.java
Thu Feb 18 12:55:59 2010
@@ -31,10 +31,11 @@
 @FacesConverter(value = "at.irian.CustomConverter")
 public class TestConverter1 implements Converter {
     public Object getAsObject(FacesContext context, UIComponent component, String value)
throws ConverterException {
-        return "hello from converter1";  //To change body of implemented methods use File
| Settings | File Templates.
+        return value;  //To change body of implemented methods use File | Settings | File
Templates.
     }
 
+    
     public String getAsString(FacesContext context, UIComponent component, Object value)
throws ConverterException {
-        return "hello from converter1";  //To change body of implemented methods use File
| Settings | File Templates.
+        return (String)value;  //To change body of implemented methods use File | Settings
| File Templates.
     }
 }

Modified: myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/validatorConverterTest/TestValidator2.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/validatorConverterTest/TestValidator2.java?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/validatorConverterTest/TestValidator2.java
(original)
+++ myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/WEB-INF/java/org/apache/myfaces/javaloader/validatorConverterTest/TestValidator2.java
Thu Feb 18 12:55:59 2010
@@ -21,6 +21,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import javax.faces.application.FacesMessage;
 import javax.faces.context.FacesContext;
 import javax.faces.component.UIComponent;
 import javax.faces.validator.ValidatorException;
@@ -32,11 +33,12 @@
  * @version $Revision$ $Date$
  */
 @FacesValidator(value = "at.irian.CustomValidator")
-
 public class TestValidator2 implements Validator {
     public void validate(FacesContext context, UIComponent component, Object value) throws
ValidatorException {
-        Log log = LogFactory.getLog(TestValidator1.class);
-        log.info("Hello world from TestValidator2");
+   
+        if(!((String)value).trim().equals("hello world")) {
+            LogFactory.getLog(TestValidator1.class).error("validation failed");
+            throw new ValidatorException(new FacesMessage("validation failed from validator
1 please input hello world, original input" + ((String)value),"validation failed from validator
1 please input hello world, original input" + ((String)value)));
+        }
     }
-
 }

Modified: myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/helloWorld.xhtml
URL: http://svn.apache.org/viewvc/myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/helloWorld.xhtml?rev=911372&r1=911371&r2=911372&view=diff
==============================================================================
--- myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/helloWorld.xhtml
(original)
+++ myfaces/extensions/scripting/trunk/examples/myfaces20-example/src/main/webapp/helloWorld.xhtml
Thu Feb 18 12:55:59 2010
@@ -14,9 +14,10 @@
         </h1>
 
         <h:form id="form">
-
             <h:panelGroup styleClass="left">
                 <h:panelGroup styleClass="stdBox">
+                    <h:messages />
+
                     <h3>Validator Test 1</h3>
                     <h:outputText id="output1" value="Please enter your name"/>
                     <h:outputText value="aaa#{javatestbean4.hello}"/>
@@ -41,6 +42,7 @@
                 </h:panelGroup>
                 <h:panelGroup styleClass="stdBox">
                     <h3>Converter Test 1</h3>
+                    please insert "hello world" into the input field
                     <h:inputText>
                         <grv:testConverter1/>
                         <grv:testValidator1/>



Mime
View raw message