The Jsr168Dispatcher does not initialize the DispatcherUtils

o backport from WW 2.2.3/2.2.4

Issue Number: WW-1440

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@442942 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rainer Hermanns
2006-09-13 11:17:23 +00:00
parent ad5ed9d9c1
commit ba1b094eb3
2 changed files with 20 additions and 14 deletions
@@ -90,7 +90,7 @@ public class Dispatcher {
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 @@ public class Dispatcher {
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 class Dispatcher {
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) {
@@ -60,6 +60,7 @@ import com.opensymphony.xwork2.ActionProxy;
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 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
private Dispatcher dispatcherUtils;
private boolean devMode = false;
/**
* Initialize the portlet with the init parameters from <tt>portlet.xml</tt>
*/
@@ -208,6 +211,12 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
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 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
+ ". Using default ObjectFactory.", e);
}
}
Dispatcher.setPortletSupportActive(true);
dispatcherUtils = new Dispatcher(ServletContextHolderListener.getServletContext());
}