diff --git a/core/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java b/core/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java
index 4397e06c8..7a9172a49 100644
--- a/core/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java
+++ b/core/src/main/java/org/apache/struts2/portlet/dispatcher/DirectRenderFromEventAction.java
@@ -17,32 +17,33 @@
*/
package org.apache.struts2.portlet.dispatcher;
-import com.opensymphony.xwork2.ActionSupport;
+import com.opensymphony.xwork2.Action;
+
+import java.io.Serializable;
/**
- * When a portlet is targetted for an event, the portlet will receive two
+ * When a portlet is targetted for an event, the portlet will receive two
* portlet requests, one for the event phase, and then followed by a render
* operation. When in the event phase, the action that is executed can't render
- * any output. This means that if an action in the XWork configuration is executed in the event
- * phase, and the action is set up with a result that should render something, the result can't
- * immediately be executed. The portlet needs to "wait" to the render phase to do the
- * rendering.
- *
- * When the {@link org.apache.struts2.portlet.result.PortletResult} detects such a
+ * any output. This means that if an action in the XWork configuration is executed in the event
+ * phase, and the action is set up with a result that should render something, the result can't
+ * immediately be executed. The portlet needs to "wait" to the render phase to do the
+ * rendering.
+ *
+ * When the {@link org.apache.struts2.portlet.result.PortletResult} detects such a
* scenario, instead of executing the actual view, it prepares a couple of render parameters
- * specifying this action and the location of the view, which then will be executed in the
+ * specifying this action and the location of the view, which then will be executed in the
* following render request.
- *
*/
-public class DirectRenderFromEventAction extends ActionSupport {
-
- private static final long serialVersionUID = -1814807772308405785L;
-
- private String location = null;
+public class DirectRenderFromEventAction implements Action, Serializable {
+
+ private static final long serialVersionUID = -1814807772308405785L;
+
+ private String location = null;
/**
* Get the location of the view.
- *
+ *
* @return Returns the location.
*/
public String getLocation() {
@@ -51,10 +52,19 @@ public class DirectRenderFromEventAction extends ActionSupport {
/**
* Set the location of the view.
- *
+ *
* @param location The location to set.
*/
public void setLocation(String location) {
this.location = location;
}
+
+ /**
+ * Always return success.
+ *
+ * @return SUCCESS
+ */
+ public String execute() throws Exception {
+ return SUCCESS;
+ }
}
diff --git a/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java b/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
index 3acab2974..c1da834a3 100644
--- a/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
+++ b/core/src/main/java/org/apache/struts2/portlet/dispatcher/Jsr168Dispatcher.java
@@ -238,7 +238,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
}
}
- dispatcherUtils = new Dispatcher(null);
+ dispatcherUtils = new Dispatcher(ServletContextHolderListener.getServletContext());
}
/**
@@ -279,14 +279,13 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
/**
* Service an action from the event phase.
- *
+ *
* @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest,
* javax.portlet.ActionResponse)
*/
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {
LOG.debug("Entering processAction");
- Dispatcher.setInstance(dispatcherUtils);
resetActionContext();
try {
serviceAction(request, response, getActionMapping(request),
@@ -301,7 +300,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
/**
* Service an action from the render phase.
- *
+ *
* @see javax.portlet.Portlet#render(javax.portlet.RenderRequest,
* javax.portlet.RenderResponse)
*/
@@ -333,7 +332,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
/**
* Merges all application and portlet attributes into a single
* HashMap to represent the entire Action context.
- *
+ *
* @param requestMap a Map of all request attributes.
* @param parameterMap a Map of all request parameters.
* @param sessionMap a Map of all session attributes.
@@ -360,11 +359,12 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
if (Settings.isSet(StrutsConstants.STRUTS_LOCALE)) {
locale = LocalizedTextUtil.localeFromString(Settings.get(StrutsConstants.STRUTS_LOCALE), request.getLocale());
} else {
- locale = request.getLocale();
+ locale = request.getLocale();
}
extraContext.put(ActionContext.LOCALE, locale);
extraContext.put(StrutsStatics.STRUTS_PORTLET_CONTEXT, getPortletContext());
+ extraContext.put(ActionContext.DEV_MODE, Boolean.valueOf(Settings.get(StrutsConstants.STRUTS_DEVMODE)));
extraContext.put(REQUEST, request);
extraContext.put(RESPONSE, response);
extraContext.put(PORTLET_CONFIG, portletConfig);
@@ -390,7 +390,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
* context from the given parameters then loads an ActionProxy
* from the given action name and namespace. After that, the action is
* executed and output channels throught the response object.
- *
+ *
* @param request the HttpServletRequest object.
* @param response the HttpServletResponse object.
* @param mapping the action mapping.
@@ -407,6 +407,7 @@ public class Jsr168Dispatcher extends GenericPortlet implements StrutsStatics,
Map sessionMap, Map applicationMap, String portletNamespace,
Integer phase) throws PortletException {
LOG.debug("serviceAction");
+ Dispatcher.setInstance(dispatcherUtils);
HashMap extraContext = createContextMap(requestMap, parameterMap,
sessionMap, applicationMap, request, response,
getPortletConfig(), phase);