You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by rs...@apache.org on 2015/04/28 16:25:40 UTC

svn commit: r1676544 - /openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java

Author: rsandtner
Date: Tue Apr 28 14:25:40 2015
New Revision: 1676544

URL: http://svn.apache.org/r1676544
Log:
OWB-1062 added lookup for JspRuntimeContext

Modified:
    openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java

Modified: openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java?rev=1676544&r1=1676543&r2=1676544&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java (original)
+++ openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java Tue Apr 28 14:25:40 2015
@@ -128,17 +128,8 @@ public final class WebContainerLifecycle
         if(getWebBeansContext().getOpenWebBeansConfiguration().isJspApplication())
         {
             logger.log(Level.FINE, "Application is configured as JSP. Adding EL Resolver.");
-            
-            JspFactory factory = JspFactory.getDefaultFactory();
-            if (factory != null) 
-            {
-                JspApplicationContext applicationCtx = factory.getJspApplicationContext((ServletContext)(startupObject));
-                applicationCtx.addELResolver(resolver);                
-            }            
-            else
-            {
-                logger.log(Level.FINE, "Default JSPFactroy instance has not found");
-            }
+
+            setJspELFactory((ServletContext) startupObject, resolver);
         }
 
         // Add BeanManager to the 'javax.enterprise.inject.spi.BeanManager' servlet context attribute
@@ -233,7 +224,36 @@ public final class WebContainerLifecycle
         
         throw new IllegalArgumentException("ServletContextEvent object but found null");
     }
-    
+
+    private void setJspELFactory(ServletContext startupObject, ELResolver resolver)
+    {
+        JspFactory factory = JspFactory.getDefaultFactory();
+        if (factory == null)
+        {
+            try
+            {
+                Class.forName("org.apache.jasper.compiler.JspRuntimeContext");
+                factory = JspFactory.getDefaultFactory();
+            }
+            catch (Exception e)
+            {
+                // ignore
+            }
+
+        }
+
+        if (factory != null)
+        {
+            JspApplicationContext applicationCtx = factory.getJspApplicationContext(startupObject);
+            applicationCtx.addELResolver(resolver);
+        }
+        else
+        {
+            logger.log(Level.FINE, "Default JSPFactroy instance has not found");
+        }
+    }
+
+
     /**
      * Conversation cleaner thread, that
      * clears unused conversations.