myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1137632 - in /myfaces/extensions/cdi/trunk: core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/ jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/
Date Mon, 20 Jun 2011 13:59:08 GMT
Author: gpetracek
Date: Mon Jun 20 13:59:08 2011
New Revision: 1137632

URL: http://svn.apache.org/viewvc?rev=1137632&view=rev
Log:
EXTCDI-184 workaround for ContextNotActiveException (caused by mojarra)

Modified:
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/PropertyFileResolver.java
    myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/SystemPropertyResolver.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/GroupedConversationContext.java

Modified: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/PropertyFileResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/PropertyFileResolver.java?rev=1137632&r1=1137631&r2=1137632&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/PropertyFileResolver.java
(original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/PropertyFileResolver.java
Mon Jun 20 13:59:08 2011
@@ -68,7 +68,7 @@ public class PropertyFileResolver extend
         }
 
         String configKey = key.substring(key.indexOf(".") + 1);
-        String configuredValue = null;
+        String configuredValue;
 
         Map<String, String> cache = getPropertyCache();
 

Modified: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/SystemPropertyResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/SystemPropertyResolver.java?rev=1137632&r1=1137631&r2=1137632&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/SystemPropertyResolver.java
(original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/config/SystemPropertyResolver.java
Mon Jun 20 13:59:08 2011
@@ -56,11 +56,22 @@ public class SystemPropertyResolver exte
         
         if(!String.class.isAssignableFrom(descriptor.getTargetType()))
         {
-            Class<T> targetClass = ClassUtils.tryToLoadClassForName(configuredValue,
descriptor.getTargetType());
-
-            if(targetClass != null)
+            if(Boolean.class.isAssignableFrom(descriptor.getTargetType()))
+            {
+                add(descriptor.getTargetType().cast(Boolean.parseBoolean(configuredValue)));
+            }
+            else if(Integer.class.isAssignableFrom(descriptor.getTargetType()))
             {
-                add(targetClass);
+                add(descriptor.getTargetType().cast(Integer.parseInt(configuredValue)));
+            }
+            else
+            {
+                Class<T> targetClass = ClassUtils.tryToLoadClassForName(configuredValue,
descriptor.getTargetType());
+
+                if(targetClass != null)
+                {
+                    add(targetClass);
+                }
             }
         }
         else

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/GroupedConversationContext.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/GroupedConversationContext.java?rev=1137632&r1=1137631&r2=1137632&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/GroupedConversationContext.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/GroupedConversationContext.java
Mon Jun 20 13:59:08 2011
@@ -67,7 +67,24 @@ class GroupedConversationContext extends
      */
     public boolean isActive()
     {
-        return FacesContext.getCurrentInstance().getExternalContext().getSession(false) !=
null;
+        if(FacesContext.getCurrentInstance().getExternalContext().getSession(false) != null)
+        {
+            return true;
+        }
+
+        //workaround for mojarra
+        if(FacesContext.getCurrentInstance().getExternalContext().getRequest() != null)
+        {
+            if(!Boolean.FALSE.equals(CodiUtils.lookupFromEnvironment("FORCE_SESSION_CREATION",
Boolean.class)))
+            {
+                //we need a the session for the contexts -> force it
+                FacesContext.getCurrentInstance().getExternalContext().getSession(true);
+            }
+            return true;
+        }
+
+        //there is no request
+        return false;
     }
 
     protected <T> Set<SecurityViolation> checkPermission(Bean<T> bean)



Mime
View raw message