diff --git a/plugins/portlet-tiles/pom.xml b/plugins/portlet-tiles/pom.xml
index bb8b6e134..9e9a81faf 100644
--- a/plugins/portlet-tiles/pom.xml
+++ b/plugins/portlet-tiles/pom.xml
@@ -42,6 +42,10 @@
org.apache.struts
struts2-portlet-plugin
+
+ org.apache.tiles
+ tiles-portlet
+
javax.servlet
jsp-api
diff --git a/plugins/portlet-tiles/src/main/java/org/apache/struts2/views/tiles/PortletTilesResult.java b/plugins/portlet-tiles/src/main/java/org/apache/struts2/views/tiles/PortletTilesResult.java
index d10693ceb..736fb8596 100644
--- a/plugins/portlet-tiles/src/main/java/org/apache/struts2/views/tiles/PortletTilesResult.java
+++ b/plugins/portlet-tiles/src/main/java/org/apache/struts2/views/tiles/PortletTilesResult.java
@@ -9,6 +9,7 @@ import org.apache.struts2.portlet.context.PortletActionContext;
import org.apache.tiles.TilesContainer;
import org.apache.tiles.TilesException;
import org.apache.tiles.access.TilesAccess;
+import org.apache.tiles.portlet.context.PortletUtil;
import javax.portlet.ActionResponse;
import javax.portlet.PortletException;
@@ -19,11 +20,13 @@ import java.io.IOException;
import java.util.Map;
/**
- * JIRA WW-2749 (STRUTS).
+ * Dedicated Tile result to be used in Portlet environment
+ *
+ * WW-2749
*/
public class PortletTilesResult extends ServletDispatcherResult {
- private static final long serialVersionUID = -3806939435493086244L;
+ public static final String TILES_ACTION_NAME = "tilesDirect";
public PortletTilesResult() {
super();
@@ -33,10 +36,7 @@ public class PortletTilesResult extends ServletDispatcherResult {
super(location);
}
- // FIXME PATCH du JIRA WW-2749 (STRUTS)
- public void doExecute(String location, ActionInvocation invocation)
- throws IOException, TemplateException, PortletException, TilesException {
-
+ public void doExecute(String location, ActionInvocation invocation) throws Exception {
if (PortletActionContext.getPhase().isAction() || PortletActionContext.getPhase().isEvent()) {
executeActionResult(location, invocation);
} else {
@@ -44,15 +44,10 @@ public class PortletTilesResult extends ServletDispatcherResult {
}
}
- /**
- * @param location
- * @throws TilesException
- */
protected void executeRenderResult(String location) throws TilesException {
setLocation(location);
- ServletContext servletContext = ServletActionContext.getServletContext();
- TilesContainer container = TilesAccess.getContainer(servletContext);
+ TilesContainer container = PortletUtil.getContainer(PortletActionContext.getPortletContext());
HttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
@@ -60,14 +55,10 @@ public class PortletTilesResult extends ServletDispatcherResult {
container.render(location, request, response);
}
- /**
- * @param location
- * @param invocation
- */
protected void executeActionResult(String location, ActionInvocation invocation) {
ActionResponse res = PortletActionContext.getActionResponse();
- res.setRenderParameter(PortletConstants.ACTION_PARAM, "tilesDirect");
+ res.setRenderParameter(PortletConstants.ACTION_PARAM, TILES_ACTION_NAME);
Map sessionMap = invocation.getInvocationContext().getSession();
sessionMap.put(PortletConstants.RENDER_DIRECT_LOCATION, location);
diff --git a/pom.xml b/pom.xml
index 098044d63..def253947 100644
--- a/pom.xml
+++ b/pom.xml
@@ -614,6 +614,11 @@
tiles-servlet
${tiles.version}
+
+ org.apache.tiles
+ tiles-portlet
+ ${tiles.version}
+
org.apache.tiles
tiles-jsp