openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r959765 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-jsf/src/main/java/org/apache/webbeans/jsf/ webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/ webbeans-web/src/main/java/org/apache/webb...
Date Thu, 01 Jul 2010 20:14:23 GMT
Author: gerdogdu
Date: Thu Jul  1 20:14:22 2010
New Revision: 959765

URL: http://svn.apache.org/viewvc?rev=959765&view=rev
Log:
Revert old commit. When JSF related plugins put into the server classpath, it is used by the
container even if no OWB runtime exist. Adding some marker that provide we run in OWB environment.

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
    openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JSFUtil.java
    openwebbeans/trunk/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/JSFUtil.java
    openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java?rev=959765&r1=959764&r2=959765&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/OpenWebBeansConfiguration.java
Thu Jul  1 20:14:22 2010
@@ -114,7 +114,7 @@ public class OpenWebBeansConfiguration
     /**EL Adaptor*/
     public static final String EL_ADAPTOR_CLASS = "org.apache.webbeans.spi.adaptor.ELAdaptor";
     
-    public static final String SYSTEM_PROPERTY_OWB_APPLICATION = "org.apache.webbeans.application.isOwbApplication";
+    public static final String PROPERTY_OWB_APPLICATION = "org.apache.webbeans.application.isOwbApplication";
     
     /**
      * Gets singleton instance.
@@ -337,12 +337,6 @@ public class OpenWebBeansConfiguration
         
     }
     
-    public boolean isOwbApplication()
-    {
-        String value = SecurityUtil.doPrivilegedGetSystemProperty(SYSTEM_PROPERTY_OWB_APPLICATION,
"false");
-        return Boolean.valueOf(value);
-    }
-    
     /**
      * Gets jsp property.
      * @return true if jsp

Modified: openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JSFUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JSFUtil.java?rev=959765&r1=959764&r2=959765&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JSFUtil.java (original)
+++ openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JSFUtil.java Thu
Jul  1 20:14:22 2010
@@ -24,6 +24,7 @@ import javax.faces.application.ViewHandl
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
 import javax.servlet.http.HttpSession;
 
 import org.apache.webbeans.config.OpenWebBeansConfiguration;
@@ -189,6 +190,21 @@ public final class JSFUtil
     
     public static boolean isOwbApplication()
     {
-        return OpenWebBeansConfiguration.getInstance().isOwbApplication();
+        ServletContext context = null;
+        if(getExternalContext() != null)
+        {
+            context = (ServletContext) getExternalContext().getContext();
+        }
+        
+        if(context != null)
+        {
+            Object value = context.getAttribute(OpenWebBeansConfiguration.PROPERTY_OWB_APPLICATION);
+            if(value != null)
+            {
+                return Boolean.valueOf(value.toString());
+            }            
+        }
+        
+        return false;
     }
 }

Modified: openwebbeans/trunk/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/JSFUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/JSFUtil.java?rev=959765&r1=959764&r2=959765&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/JSFUtil.java
(original)
+++ openwebbeans/trunk/webbeans-jsf12/src/main/java/org/apache/webbeans/jsf12/JSFUtil.java
Thu Jul  1 20:14:22 2010
@@ -24,6 +24,7 @@ import javax.faces.application.ViewHandl
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
 import javax.servlet.http.HttpSession;
 
 import org.apache.webbeans.config.OpenWebBeansConfiguration;
@@ -189,6 +190,22 @@ public final class JSFUtil
     
     public static boolean isOwbApplication()
     {
-        return OpenWebBeansConfiguration.getInstance().isOwbApplication();
+        ServletContext context = null;
+        if(getExternalContext() != null)
+        {
+            context = (ServletContext) getExternalContext().getContext();
+        }
+        
+        if(context != null)
+        {
+            Object value = context.getAttribute(OpenWebBeansConfiguration.PROPERTY_OWB_APPLICATION);
+            if(value != null)
+            {
+                return Boolean.valueOf(value.toString());
+            }            
+        }
+        
+        return false;
+
     }    
 }

Modified: openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java?rev=959765&r1=959764&r2=959765&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java
(original)
+++ openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/servlet/WebBeansConfigurationListener.java
Thu Jul  1 20:14:22 2010
@@ -36,7 +36,6 @@ import org.apache.webbeans.conversation.
 import org.apache.webbeans.lifecycle.LifecycleFactory;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.spi.ContainerLifecycle;
-import org.apache.webbeans.util.SecurityUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 
 /**
@@ -71,7 +70,7 @@ public class WebBeansConfigurationListen
         try
         {
                 this.lifeCycle.startApplication(event);  
-                SecurityUtil.doPrivilegedSetSystemProperty(OpenWebBeansConfiguration.SYSTEM_PROPERTY_OWB_APPLICATION,
"true");
+                event.getServletContext().setAttribute(OpenWebBeansConfiguration.PROPERTY_OWB_APPLICATION,
"true");
         }
         catch (Exception e)
         {
@@ -88,7 +87,7 @@ public class WebBeansConfigurationListen
     {
         this.lifeCycle.stopApplication(event);
         this.lifeCycle = null;
-        SecurityUtil.doPrivilegedSetSystemProperty(OpenWebBeansConfiguration.SYSTEM_PROPERTY_OWB_APPLICATION,
"false");
+        event.getServletContext().setAttribute(OpenWebBeansConfiguration.PROPERTY_OWB_APPLICATION,
"false");
     }
 
     /**



Mime
View raw message