Author: hermanns
Date: Wed Sep 13 04:17:23 2006
New Revision: 442942

URL: http://svn.apache.org/viewvc?view=rev&rev=442942
Log:
The Jsr168Dispatcher does not initialize the DispatcherUtils
o backport from WW 2.2.3/2.2.4

Issue Number: WW-1440

Modified:
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
    
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java?view=diff&rev=442942&r1=442941&r2=442942
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
 Wed Sep 13 04:17:23 2006
@@ -90,7 +90,7 @@
         new ArrayList<DispatcherListener>();
     
     private ConfigurationManager configurationManager;
-    private boolean portletSupportActive;
+    private static boolean portletSupportActive;
     private boolean devMode = false;
 
     // used to get WebLogic to play nice
@@ -250,17 +250,6 @@
             LOG.debug("Parameter access work-around disabled.");
         }
 
-        // Check whether portlet support is active or not by trying to get 
"javax.portlet.PortletRequest"
-        try {
-            ClassLoaderUtil.loadClass("javax.portlet.PortletRequest", 
Dispatcher.class);
-            portletSupportActive = true;
-            if (LOG.isInfoEnabled()) {
-                LOG.info("Found portlet-api. Activating Struts's portlet 
support");
-            }
-        } catch (ClassNotFoundException e) {
-            LOG.debug("Unable to locate the portlet libraries.  Disabling 
portlet support.");
-        }
-        
         configurationManager = new ConfigurationManager();
         
         // Load old xwork files
@@ -610,7 +599,15 @@
     public boolean isPortletSupportActive() {
         return portletSupportActive;
     }
-    
+
+    /**
+     * Set the flag that portlet support is active or not.
+     * @param portletSupportActive <tt>true</tt> or <tt>false</tt>
+     */
+    public static void setPortletSupportActive(boolean portletSupportActive) {
+        Dispatcher.portletSupportActive = portletSupportActive;
+    }
+
     /** Simple accessor for a static method */
     public class Locator {
         public Location getLocation(Object obj) {

Modified: 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
URL: 
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java?view=diff&rev=442942&r1=442941&r2=442942
==============================================================================
--- 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
 (original)
+++ 
struts/struts2/trunk/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
 Wed Sep 13 04:17:23 2006
@@ -60,6 +60,7 @@
 import com.opensymphony.xwork2.ActionProxyFactory;
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.config.ConfigurationException;
+import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
 import com.opensymphony.xwork2.util.OgnlValueStack;
 
@@ -168,6 +169,8 @@
     
     private Dispatcher dispatcherUtils;
 
+    private boolean devMode = false;
+
     /**
      * Initialize the portlet with the init parameters from 
<tt>portlet.xml</tt>
      */
@@ -208,6 +211,12 @@
             FileManager.setReloadingConfigs(true);
         }
 
+        if 
("true".equalsIgnoreCase(Settings.get(StrutsConstants.STRUTS_DEVMODE))) {
+            devMode = true;
+            Settings.set(StrutsConstants.STRUTS_I18N_RELOAD, "true");
+            Settings.set(StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD, 
"true");
+        }
+
         if (Settings.isSet(StrutsConstants.STRUTS_OBJECTFACTORY)) {
             String className = (String) Settings
                     .get(StrutsConstants.STRUTS_OBJECTFACTORY);
@@ -237,7 +246,7 @@
                         + ". Using default ObjectFactory.", e);
             }
         }
-        
+        Dispatcher.setPortletSupportActive(true);
         dispatcherUtils = new 
Dispatcher(ServletContextHolderListener.getServletContext());
     }
 


Reply via email to