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 2010/05/04 23:24:26 UTC

svn commit: r941050 - in /myfaces/core/trunk/impl/src/main: conf/META-INF/standard-faces-config-base.xml java/org/apache/myfaces/config/FacesConfigurator.java

Author: lu4242
Date: Tue May  4 21:24:26 2010
New Revision: 941050

URL: http://svn.apache.org/viewvc?rev=941050&view=rev
Log:
MYFACES-2697 BeanValidation class is annotated with @FacesValidator tag

Modified:
    myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
    myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java

Modified: myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml?rev=941050&r1=941049&r2=941050&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml (original)
+++ myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml Tue May  4 21:24:26 2010
@@ -32,6 +32,9 @@
       <state-manager>org.apache.myfaces.application.jsp.JspStateManagerImpl</state-manager>
       <navigation-handler>org.apache.myfaces.application.NavigationHandlerImpl</navigation-handler>
       <resource-handler>org.apache.myfaces.application.ResourceHandlerImpl</resource-handler>
+      <default-validators>
+          <validator-id>javax.faces.Bean</validator-id>
+      </default-validators>
    </application>
    <factory>
       <application-factory>org.apache.myfaces.application.ApplicationFactoryImpl</application-factory>

Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java?rev=941050&r1=941049&r2=941050&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java Tue May  4 21:24:26 2010
@@ -55,7 +55,6 @@ import javax.faces.application.Applicati
 import javax.faces.application.ApplicationFactory;
 import javax.faces.application.ConfigurableNavigationHandler;
 import javax.faces.application.NavigationHandler;
-import javax.faces.application.ProjectStage;
 import javax.faces.application.ResourceHandler;
 import javax.faces.application.StateManager;
 import javax.faces.application.ViewHandler;
@@ -117,7 +116,6 @@ import org.apache.myfaces.util.Container
 import org.apache.myfaces.util.ExternalSpecifications;
 import org.apache.myfaces.view.ViewDeclarationLanguageFactoryImpl;
 import org.apache.myfaces.view.facelets.tag.jsf.TagHandlerDelegateFactoryImpl;
-import org.apache.myfaces.view.facelets.tag.ui.DebugPhaseListener;
 import org.apache.myfaces.view.facelets.util.Classpath;
 import org.xml.sax.SAXException;
 
@@ -2000,24 +1998,37 @@ public class FacesConfigurator
             application.addValidator(validatorId, dispenser.getValidatorClass(validatorId));
         }
 
-        //
-        if (ExternalSpecifications.isBeanValidationAvailable())
-        {
-            String disabled = _externalContext.getInitParameter(BeanValidator.DISABLE_DEFAULT_BEAN_VALIDATOR_PARAM_NAME);
-            boolean defaultBeanValidatorDisabled = (disabled != null && disabled.toLowerCase().equals("true"));
-            if (!defaultBeanValidatorDisabled)
-            {
-                application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
-            }
-        }
-        
         // only add default validators if there is no empty <default-validators> in faces-config.xml
         if (!dispenser.isEmptyDefaultValidators())
         {
+            boolean beanValidatorAdded = false;
             for (String validatorId : dispenser.getDefaultValidatorIds())
             {
+                if (validatorId.equals(BeanValidator.VALIDATOR_ID))
+                {
+                    if (!ExternalSpecifications.isBeanValidationAvailable())
+                    {
+                        // do not add it as a default validator
+                        continue;
+                    }
+                    else
+                    {
+                        beanValidatorAdded = true;
+                    }
+                }
                 application.addDefaultValidatorId(validatorId);
             }
+        
+            // add the bean validator if it is available, not already added and not disabled
+            if (!beanValidatorAdded && ExternalSpecifications.isBeanValidationAvailable())
+            {
+                String disabled = _externalContext.getInitParameter(BeanValidator.DISABLE_DEFAULT_BEAN_VALIDATOR_PARAM_NAME);
+                boolean defaultBeanValidatorDisabled = (disabled != null && disabled.toLowerCase().equals("true"));
+                if (!defaultBeanValidatorDisabled)
+                {
+                    application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
+                }
+            }
         }
 
         for (Behavior behavior : dispenser.getBehaviors()) {
@@ -2363,15 +2374,6 @@ public class FacesConfigurator
                 log.severe("Class " + listenerClassName + " does not implement PhaseListener");
             }
         }
-        
-        // if ProjectStage is Development, install the DebugPhaseListener
-        // Note that FacesContext.getCurrentInstance() will be null for the very first
-        // initialisation here. In that case the PhaseListener is installed in AbstractFacesInitializer.
-        FacesContext facesContext = FacesContext.getCurrentInstance();
-        if (facesContext != null && facesContext.isProjectStage(ProjectStage.Development))
-        {
-            lifecycle.addPhaseListener(new DebugPhaseListener());
-        }
     }
 
     private String getLifecycleId()



Re: svn commit: r941050 - in /myfaces/core/trunk/impl/src/main: conf/META-INF/standard-faces-config-base.xml java/org/apache/myfaces/config/FacesConfigurator.java

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

Thanks!

regards,

Leonardo

2010/5/4 Jakob Korherr <ja...@gmail.com>

> Hi,
>
> OK, no problem. I just reverted that part of the code!
>
> Regards,
> jakob
>
> 2010/5/4 Leonardo Uribe <lu...@gmail.com>
>
> Hi
>>
>> I don't know, there should be something wrong on my machine. It was
>> unintentional. Please revert the code.
>>
>> regards,
>>
>> Leonardo
>>
>> 2010/5/4 Jakob Korherr <ja...@gmail.com>
>>
>> Hi Leo,
>>>
>>> Why did you remove the installation of the DebugPhaseListener with this
>>> commit?
>>>
>>> Regards,
>>> Jakob
>>>
>>> 2010/5/4 <lu...@apache.org>
>>>
>>>> Author: lu4242
>>>> Date: Tue May  4 21:24:26 2010
>>>> New Revision: 941050
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=941050&view=rev
>>>> Log:
>>>> MYFACES-2697 BeanValidation class is annotated with @FacesValidator tag
>>>>
>>>> Modified:
>>>>
>>>>  myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
>>>>
>>>>  myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
>>>>
>>>> Modified:
>>>> myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
>>>> URL:
>>>> http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml?rev=941050&r1=941049&r2=941050&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
>>>> (original)
>>>> +++
>>>> myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
>>>> Tue May  4 21:24:26 2010
>>>> @@ -32,6 +32,9 @@
>>>>
>>>> <state-manager>org.apache.myfaces.application.jsp.JspStateManagerImpl</state-manager>
>>>>
>>>> <navigation-handler>org.apache.myfaces.application.NavigationHandlerImpl</navigation-handler>
>>>>
>>>> <resource-handler>org.apache.myfaces.application.ResourceHandlerImpl</resource-handler>
>>>> +      <default-validators>
>>>> +          <validator-id>javax.faces.Bean</validator-id>
>>>> +      </default-validators>
>>>>    </application>
>>>>    <factory>
>>>>
>>>> <application-factory>org.apache.myfaces.application.ApplicationFactoryImpl</application-factory>
>>>>
>>>> Modified:
>>>> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
>>>> URL:
>>>> http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java?rev=941050&r1=941049&r2=941050&view=diff
>>>>
>>>> ==============================================================================
>>>> ---
>>>> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
>>>> (original)
>>>> +++
>>>> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
>>>> Tue May  4 21:24:26 2010
>>>> @@ -55,7 +55,6 @@ import javax.faces.application.Applicati
>>>>  import javax.faces.application.ApplicationFactory;
>>>>  import javax.faces.application.ConfigurableNavigationHandler;
>>>>  import javax.faces.application.NavigationHandler;
>>>> -import javax.faces.application.ProjectStage;
>>>>  import javax.faces.application.ResourceHandler;
>>>>  import javax.faces.application.StateManager;
>>>>  import javax.faces.application.ViewHandler;
>>>> @@ -117,7 +116,6 @@ import org.apache.myfaces.util.Container
>>>>  import org.apache.myfaces.util.ExternalSpecifications;
>>>>  import org.apache.myfaces.view.ViewDeclarationLanguageFactoryImpl;
>>>>  import
>>>> org.apache.myfaces.view.facelets.tag.jsf.TagHandlerDelegateFactoryImpl;
>>>> -import org.apache.myfaces.view.facelets.tag.ui.DebugPhaseListener;
>>>>  import org.apache.myfaces.view.facelets.util.Classpath;
>>>>  import org.xml.sax.SAXException;
>>>>
>>>> @@ -2000,24 +1998,37 @@ public class FacesConfigurator
>>>>             application.addValidator(validatorId,
>>>> dispenser.getValidatorClass(validatorId));
>>>>         }
>>>>
>>>> -        //
>>>> -        if (ExternalSpecifications.isBeanValidationAvailable())
>>>> -        {
>>>> -            String disabled =
>>>> _externalContext.getInitParameter(BeanValidator.DISABLE_DEFAULT_BEAN_VALIDATOR_PARAM_NAME);
>>>> -            boolean defaultBeanValidatorDisabled = (disabled != null &&
>>>> disabled.toLowerCase().equals("true"));
>>>> -            if (!defaultBeanValidatorDisabled)
>>>> -            {
>>>> -
>>>>  application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
>>>> -            }
>>>> -        }
>>>> -
>>>>         // only add default validators if there is no empty
>>>> <default-validators> in faces-config.xml
>>>>         if (!dispenser.isEmptyDefaultValidators())
>>>>         {
>>>> +            boolean beanValidatorAdded = false;
>>>>             for (String validatorId :
>>>> dispenser.getDefaultValidatorIds())
>>>>             {
>>>> +                if (validatorId.equals(BeanValidator.VALIDATOR_ID))
>>>> +                {
>>>> +                    if
>>>> (!ExternalSpecifications.isBeanValidationAvailable())
>>>> +                    {
>>>> +                        // do not add it as a default validator
>>>> +                        continue;
>>>> +                    }
>>>> +                    else
>>>> +                    {
>>>> +                        beanValidatorAdded = true;
>>>> +                    }
>>>> +                }
>>>>                 application.addDefaultValidatorId(validatorId);
>>>>             }
>>>> +
>>>> +            // add the bean validator if it is available, not already
>>>> added and not disabled
>>>> +            if (!beanValidatorAdded &&
>>>> ExternalSpecifications.isBeanValidationAvailable())
>>>> +            {
>>>> +                String disabled =
>>>> _externalContext.getInitParameter(BeanValidator.DISABLE_DEFAULT_BEAN_VALIDATOR_PARAM_NAME);
>>>> +                boolean defaultBeanValidatorDisabled = (disabled !=
>>>> null && disabled.toLowerCase().equals("true"));
>>>> +                if (!defaultBeanValidatorDisabled)
>>>> +                {
>>>> +
>>>>  application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
>>>> +                }
>>>> +            }
>>>>         }
>>>>
>>>>         for (Behavior behavior : dispenser.getBehaviors()) {
>>>> @@ -2363,15 +2374,6 @@ public class FacesConfigurator
>>>>                 log.severe("Class " + listenerClassName + " does not
>>>> implement PhaseListener");
>>>>             }
>>>>         }
>>>> -
>>>> -        // if ProjectStage is Development, install the
>>>> DebugPhaseListener
>>>> -        // Note that FacesContext.getCurrentInstance() will be null for
>>>> the very first
>>>> -        // initialisation here. In that case the PhaseListener is
>>>> installed in AbstractFacesInitializer.
>>>> -        FacesContext facesContext = FacesContext.getCurrentInstance();
>>>> -        if (facesContext != null &&
>>>> facesContext.isProjectStage(ProjectStage.Development))
>>>> -        {
>>>> -            lifecycle.addPhaseListener(new DebugPhaseListener());
>>>> -        }
>>>>     }
>>>>
>>>>     private String getLifecycleId()
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Jakob Korherr
>>>
>>> blog: http://www.jakobk.com
>>> twitter: http://twitter.com/jakobkorherr
>>> work: http://www.irian.at
>>>
>>
>>
>
>
> --
> Jakob Korherr
>
> blog: http://www.jakobk.com
> twitter: http://twitter.com/jakobkorherr
> work: http://www.irian.at
>

Re: svn commit: r941050 - in /myfaces/core/trunk/impl/src/main: conf/META-INF/standard-faces-config-base.xml java/org/apache/myfaces/config/FacesConfigurator.java

Posted by Jakob Korherr <ja...@gmail.com>.
Hi,

OK, no problem. I just reverted that part of the code!

Regards,
jakob

2010/5/4 Leonardo Uribe <lu...@gmail.com>

> Hi
>
> I don't know, there should be something wrong on my machine. It was
> unintentional. Please revert the code.
>
> regards,
>
> Leonardo
>
> 2010/5/4 Jakob Korherr <ja...@gmail.com>
>
> Hi Leo,
>>
>> Why did you remove the installation of the DebugPhaseListener with this
>> commit?
>>
>> Regards,
>> Jakob
>>
>> 2010/5/4 <lu...@apache.org>
>>
>>> Author: lu4242
>>> Date: Tue May  4 21:24:26 2010
>>> New Revision: 941050
>>>
>>> URL: http://svn.apache.org/viewvc?rev=941050&view=rev
>>> Log:
>>> MYFACES-2697 BeanValidation class is annotated with @FacesValidator tag
>>>
>>> Modified:
>>>
>>>  myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
>>>
>>>  myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
>>>
>>> Modified:
>>> myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
>>> URL:
>>> http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml?rev=941050&r1=941049&r2=941050&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
>>> (original)
>>> +++
>>> myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
>>> Tue May  4 21:24:26 2010
>>> @@ -32,6 +32,9 @@
>>>
>>> <state-manager>org.apache.myfaces.application.jsp.JspStateManagerImpl</state-manager>
>>>
>>> <navigation-handler>org.apache.myfaces.application.NavigationHandlerImpl</navigation-handler>
>>>
>>> <resource-handler>org.apache.myfaces.application.ResourceHandlerImpl</resource-handler>
>>> +      <default-validators>
>>> +          <validator-id>javax.faces.Bean</validator-id>
>>> +      </default-validators>
>>>    </application>
>>>    <factory>
>>>
>>> <application-factory>org.apache.myfaces.application.ApplicationFactoryImpl</application-factory>
>>>
>>> Modified:
>>> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
>>> URL:
>>> http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java?rev=941050&r1=941049&r2=941050&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
>>> (original)
>>> +++
>>> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
>>> Tue May  4 21:24:26 2010
>>> @@ -55,7 +55,6 @@ import javax.faces.application.Applicati
>>>  import javax.faces.application.ApplicationFactory;
>>>  import javax.faces.application.ConfigurableNavigationHandler;
>>>  import javax.faces.application.NavigationHandler;
>>> -import javax.faces.application.ProjectStage;
>>>  import javax.faces.application.ResourceHandler;
>>>  import javax.faces.application.StateManager;
>>>  import javax.faces.application.ViewHandler;
>>> @@ -117,7 +116,6 @@ import org.apache.myfaces.util.Container
>>>  import org.apache.myfaces.util.ExternalSpecifications;
>>>  import org.apache.myfaces.view.ViewDeclarationLanguageFactoryImpl;
>>>  import
>>> org.apache.myfaces.view.facelets.tag.jsf.TagHandlerDelegateFactoryImpl;
>>> -import org.apache.myfaces.view.facelets.tag.ui.DebugPhaseListener;
>>>  import org.apache.myfaces.view.facelets.util.Classpath;
>>>  import org.xml.sax.SAXException;
>>>
>>> @@ -2000,24 +1998,37 @@ public class FacesConfigurator
>>>             application.addValidator(validatorId,
>>> dispenser.getValidatorClass(validatorId));
>>>         }
>>>
>>> -        //
>>> -        if (ExternalSpecifications.isBeanValidationAvailable())
>>> -        {
>>> -            String disabled =
>>> _externalContext.getInitParameter(BeanValidator.DISABLE_DEFAULT_BEAN_VALIDATOR_PARAM_NAME);
>>> -            boolean defaultBeanValidatorDisabled = (disabled != null &&
>>> disabled.toLowerCase().equals("true"));
>>> -            if (!defaultBeanValidatorDisabled)
>>> -            {
>>> -
>>>  application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
>>> -            }
>>> -        }
>>> -
>>>         // only add default validators if there is no empty
>>> <default-validators> in faces-config.xml
>>>         if (!dispenser.isEmptyDefaultValidators())
>>>         {
>>> +            boolean beanValidatorAdded = false;
>>>             for (String validatorId : dispenser.getDefaultValidatorIds())
>>>             {
>>> +                if (validatorId.equals(BeanValidator.VALIDATOR_ID))
>>> +                {
>>> +                    if
>>> (!ExternalSpecifications.isBeanValidationAvailable())
>>> +                    {
>>> +                        // do not add it as a default validator
>>> +                        continue;
>>> +                    }
>>> +                    else
>>> +                    {
>>> +                        beanValidatorAdded = true;
>>> +                    }
>>> +                }
>>>                 application.addDefaultValidatorId(validatorId);
>>>             }
>>> +
>>> +            // add the bean validator if it is available, not already
>>> added and not disabled
>>> +            if (!beanValidatorAdded &&
>>> ExternalSpecifications.isBeanValidationAvailable())
>>> +            {
>>> +                String disabled =
>>> _externalContext.getInitParameter(BeanValidator.DISABLE_DEFAULT_BEAN_VALIDATOR_PARAM_NAME);
>>> +                boolean defaultBeanValidatorDisabled = (disabled != null
>>> && disabled.toLowerCase().equals("true"));
>>> +                if (!defaultBeanValidatorDisabled)
>>> +                {
>>> +
>>>  application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
>>> +                }
>>> +            }
>>>         }
>>>
>>>         for (Behavior behavior : dispenser.getBehaviors()) {
>>> @@ -2363,15 +2374,6 @@ public class FacesConfigurator
>>>                 log.severe("Class " + listenerClassName + " does not
>>> implement PhaseListener");
>>>             }
>>>         }
>>> -
>>> -        // if ProjectStage is Development, install the
>>> DebugPhaseListener
>>> -        // Note that FacesContext.getCurrentInstance() will be null for
>>> the very first
>>> -        // initialisation here. In that case the PhaseListener is
>>> installed in AbstractFacesInitializer.
>>> -        FacesContext facesContext = FacesContext.getCurrentInstance();
>>> -        if (facesContext != null &&
>>> facesContext.isProjectStage(ProjectStage.Development))
>>> -        {
>>> -            lifecycle.addPhaseListener(new DebugPhaseListener());
>>> -        }
>>>     }
>>>
>>>     private String getLifecycleId()
>>>
>>>
>>>
>>
>>
>> --
>> Jakob Korherr
>>
>> blog: http://www.jakobk.com
>> twitter: http://twitter.com/jakobkorherr
>> work: http://www.irian.at
>>
>
>


-- 
Jakob Korherr

blog: http://www.jakobk.com
twitter: http://twitter.com/jakobkorherr
work: http://www.irian.at

Re: svn commit: r941050 - in /myfaces/core/trunk/impl/src/main: conf/META-INF/standard-faces-config-base.xml java/org/apache/myfaces/config/FacesConfigurator.java

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

I don't know, there should be something wrong on my machine. It was
unintentional. Please revert the code.

regards,

Leonardo

2010/5/4 Jakob Korherr <ja...@gmail.com>

> Hi Leo,
>
> Why did you remove the installation of the DebugPhaseListener with this
> commit?
>
> Regards,
> Jakob
>
> 2010/5/4 <lu...@apache.org>
>
>> Author: lu4242
>> Date: Tue May  4 21:24:26 2010
>> New Revision: 941050
>>
>> URL: http://svn.apache.org/viewvc?rev=941050&view=rev
>> Log:
>> MYFACES-2697 BeanValidation class is annotated with @FacesValidator tag
>>
>> Modified:
>>
>>  myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
>>
>>  myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
>>
>> Modified:
>> myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
>> URL:
>> http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml?rev=941050&r1=941049&r2=941050&view=diff
>>
>> ==============================================================================
>> ---
>> myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
>> (original)
>> +++
>> myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
>> Tue May  4 21:24:26 2010
>> @@ -32,6 +32,9 @@
>>
>> <state-manager>org.apache.myfaces.application.jsp.JspStateManagerImpl</state-manager>
>>
>> <navigation-handler>org.apache.myfaces.application.NavigationHandlerImpl</navigation-handler>
>>
>> <resource-handler>org.apache.myfaces.application.ResourceHandlerImpl</resource-handler>
>> +      <default-validators>
>> +          <validator-id>javax.faces.Bean</validator-id>
>> +      </default-validators>
>>    </application>
>>    <factory>
>>
>> <application-factory>org.apache.myfaces.application.ApplicationFactoryImpl</application-factory>
>>
>> Modified:
>> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
>> URL:
>> http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java?rev=941050&r1=941049&r2=941050&view=diff
>>
>> ==============================================================================
>> ---
>> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
>> (original)
>> +++
>> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
>> Tue May  4 21:24:26 2010
>> @@ -55,7 +55,6 @@ import javax.faces.application.Applicati
>>  import javax.faces.application.ApplicationFactory;
>>  import javax.faces.application.ConfigurableNavigationHandler;
>>  import javax.faces.application.NavigationHandler;
>> -import javax.faces.application.ProjectStage;
>>  import javax.faces.application.ResourceHandler;
>>  import javax.faces.application.StateManager;
>>  import javax.faces.application.ViewHandler;
>> @@ -117,7 +116,6 @@ import org.apache.myfaces.util.Container
>>  import org.apache.myfaces.util.ExternalSpecifications;
>>  import org.apache.myfaces.view.ViewDeclarationLanguageFactoryImpl;
>>  import
>> org.apache.myfaces.view.facelets.tag.jsf.TagHandlerDelegateFactoryImpl;
>> -import org.apache.myfaces.view.facelets.tag.ui.DebugPhaseListener;
>>  import org.apache.myfaces.view.facelets.util.Classpath;
>>  import org.xml.sax.SAXException;
>>
>> @@ -2000,24 +1998,37 @@ public class FacesConfigurator
>>             application.addValidator(validatorId,
>> dispenser.getValidatorClass(validatorId));
>>         }
>>
>> -        //
>> -        if (ExternalSpecifications.isBeanValidationAvailable())
>> -        {
>> -            String disabled =
>> _externalContext.getInitParameter(BeanValidator.DISABLE_DEFAULT_BEAN_VALIDATOR_PARAM_NAME);
>> -            boolean defaultBeanValidatorDisabled = (disabled != null &&
>> disabled.toLowerCase().equals("true"));
>> -            if (!defaultBeanValidatorDisabled)
>> -            {
>> -
>>  application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
>> -            }
>> -        }
>> -
>>         // only add default validators if there is no empty
>> <default-validators> in faces-config.xml
>>         if (!dispenser.isEmptyDefaultValidators())
>>         {
>> +            boolean beanValidatorAdded = false;
>>             for (String validatorId : dispenser.getDefaultValidatorIds())
>>             {
>> +                if (validatorId.equals(BeanValidator.VALIDATOR_ID))
>> +                {
>> +                    if
>> (!ExternalSpecifications.isBeanValidationAvailable())
>> +                    {
>> +                        // do not add it as a default validator
>> +                        continue;
>> +                    }
>> +                    else
>> +                    {
>> +                        beanValidatorAdded = true;
>> +                    }
>> +                }
>>                 application.addDefaultValidatorId(validatorId);
>>             }
>> +
>> +            // add the bean validator if it is available, not already
>> added and not disabled
>> +            if (!beanValidatorAdded &&
>> ExternalSpecifications.isBeanValidationAvailable())
>> +            {
>> +                String disabled =
>> _externalContext.getInitParameter(BeanValidator.DISABLE_DEFAULT_BEAN_VALIDATOR_PARAM_NAME);
>> +                boolean defaultBeanValidatorDisabled = (disabled != null
>> && disabled.toLowerCase().equals("true"));
>> +                if (!defaultBeanValidatorDisabled)
>> +                {
>> +
>>  application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
>> +                }
>> +            }
>>         }
>>
>>         for (Behavior behavior : dispenser.getBehaviors()) {
>> @@ -2363,15 +2374,6 @@ public class FacesConfigurator
>>                 log.severe("Class " + listenerClassName + " does not
>> implement PhaseListener");
>>             }
>>         }
>> -
>> -        // if ProjectStage is Development, install the DebugPhaseListener
>> -        // Note that FacesContext.getCurrentInstance() will be null for
>> the very first
>> -        // initialisation here. In that case the PhaseListener is
>> installed in AbstractFacesInitializer.
>> -        FacesContext facesContext = FacesContext.getCurrentInstance();
>> -        if (facesContext != null &&
>> facesContext.isProjectStage(ProjectStage.Development))
>> -        {
>> -            lifecycle.addPhaseListener(new DebugPhaseListener());
>> -        }
>>     }
>>
>>     private String getLifecycleId()
>>
>>
>>
>
>
> --
> Jakob Korherr
>
> blog: http://www.jakobk.com
> twitter: http://twitter.com/jakobkorherr
> work: http://www.irian.at
>

Re: svn commit: r941050 - in /myfaces/core/trunk/impl/src/main: conf/META-INF/standard-faces-config-base.xml java/org/apache/myfaces/config/FacesConfigurator.java

Posted by Jakob Korherr <ja...@gmail.com>.
Hi Leo,

Why did you remove the installation of the DebugPhaseListener with this
commit?

Regards,
Jakob

2010/5/4 <lu...@apache.org>

> Author: lu4242
> Date: Tue May  4 21:24:26 2010
> New Revision: 941050
>
> URL: http://svn.apache.org/viewvc?rev=941050&view=rev
> Log:
> MYFACES-2697 BeanValidation class is annotated with @FacesValidator tag
>
> Modified:
>
>  myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
>
>  myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
>
> Modified:
> myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
> URL:
> http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml?rev=941050&r1=941049&r2=941050&view=diff
>
> ==============================================================================
> ---
> myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
> (original)
> +++
> myfaces/core/trunk/impl/src/main/conf/META-INF/standard-faces-config-base.xml
> Tue May  4 21:24:26 2010
> @@ -32,6 +32,9 @@
>
> <state-manager>org.apache.myfaces.application.jsp.JspStateManagerImpl</state-manager>
>
> <navigation-handler>org.apache.myfaces.application.NavigationHandlerImpl</navigation-handler>
>
> <resource-handler>org.apache.myfaces.application.ResourceHandlerImpl</resource-handler>
> +      <default-validators>
> +          <validator-id>javax.faces.Bean</validator-id>
> +      </default-validators>
>    </application>
>    <factory>
>
> <application-factory>org.apache.myfaces.application.ApplicationFactoryImpl</application-factory>
>
> Modified:
> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
> URL:
> http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java?rev=941050&r1=941049&r2=941050&view=diff
>
> ==============================================================================
> ---
> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
> (original)
> +++
> myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/config/FacesConfigurator.java
> Tue May  4 21:24:26 2010
> @@ -55,7 +55,6 @@ import javax.faces.application.Applicati
>  import javax.faces.application.ApplicationFactory;
>  import javax.faces.application.ConfigurableNavigationHandler;
>  import javax.faces.application.NavigationHandler;
> -import javax.faces.application.ProjectStage;
>  import javax.faces.application.ResourceHandler;
>  import javax.faces.application.StateManager;
>  import javax.faces.application.ViewHandler;
> @@ -117,7 +116,6 @@ import org.apache.myfaces.util.Container
>  import org.apache.myfaces.util.ExternalSpecifications;
>  import org.apache.myfaces.view.ViewDeclarationLanguageFactoryImpl;
>  import
> org.apache.myfaces.view.facelets.tag.jsf.TagHandlerDelegateFactoryImpl;
> -import org.apache.myfaces.view.facelets.tag.ui.DebugPhaseListener;
>  import org.apache.myfaces.view.facelets.util.Classpath;
>  import org.xml.sax.SAXException;
>
> @@ -2000,24 +1998,37 @@ public class FacesConfigurator
>             application.addValidator(validatorId,
> dispenser.getValidatorClass(validatorId));
>         }
>
> -        //
> -        if (ExternalSpecifications.isBeanValidationAvailable())
> -        {
> -            String disabled =
> _externalContext.getInitParameter(BeanValidator.DISABLE_DEFAULT_BEAN_VALIDATOR_PARAM_NAME);
> -            boolean defaultBeanValidatorDisabled = (disabled != null &&
> disabled.toLowerCase().equals("true"));
> -            if (!defaultBeanValidatorDisabled)
> -            {
> -
>  application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
> -            }
> -        }
> -
>         // only add default validators if there is no empty
> <default-validators> in faces-config.xml
>         if (!dispenser.isEmptyDefaultValidators())
>         {
> +            boolean beanValidatorAdded = false;
>             for (String validatorId : dispenser.getDefaultValidatorIds())
>             {
> +                if (validatorId.equals(BeanValidator.VALIDATOR_ID))
> +                {
> +                    if
> (!ExternalSpecifications.isBeanValidationAvailable())
> +                    {
> +                        // do not add it as a default validator
> +                        continue;
> +                    }
> +                    else
> +                    {
> +                        beanValidatorAdded = true;
> +                    }
> +                }
>                 application.addDefaultValidatorId(validatorId);
>             }
> +
> +            // add the bean validator if it is available, not already
> added and not disabled
> +            if (!beanValidatorAdded &&
> ExternalSpecifications.isBeanValidationAvailable())
> +            {
> +                String disabled =
> _externalContext.getInitParameter(BeanValidator.DISABLE_DEFAULT_BEAN_VALIDATOR_PARAM_NAME);
> +                boolean defaultBeanValidatorDisabled = (disabled != null
> && disabled.toLowerCase().equals("true"));
> +                if (!defaultBeanValidatorDisabled)
> +                {
> +
>  application.addDefaultValidatorId(BeanValidator.VALIDATOR_ID);
> +                }
> +            }
>         }
>
>         for (Behavior behavior : dispenser.getBehaviors()) {
> @@ -2363,15 +2374,6 @@ public class FacesConfigurator
>                 log.severe("Class " + listenerClassName + " does not
> implement PhaseListener");
>             }
>         }
> -
> -        // if ProjectStage is Development, install the DebugPhaseListener
> -        // Note that FacesContext.getCurrentInstance() will be null for
> the very first
> -        // initialisation here. In that case the PhaseListener is
> installed in AbstractFacesInitializer.
> -        FacesContext facesContext = FacesContext.getCurrentInstance();
> -        if (facesContext != null &&
> facesContext.isProjectStage(ProjectStage.Development))
> -        {
> -            lifecycle.addPhaseListener(new DebugPhaseListener());
> -        }
>     }
>
>     private String getLifecycleId()
>
>
>


-- 
Jakob Korherr

blog: http://www.jakobk.com
twitter: http://twitter.com/jakobkorherr
work: http://www.irian.at