You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2016/01/10 12:22:03 UTC
[05/16] struts git commit: Updates Portal Tiles integration (cherry
picked from commit 6edc0ff)
Updates Portal Tiles integration
(cherry picked from commit 6edc0ff)
Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/ddeb7f0f
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/ddeb7f0f
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/ddeb7f0f
Branch: refs/heads/support-2-3
Commit: ddeb7f0f7cc2600ceb36b8532fc433861a38c20e
Parents: 5d30eb1
Author: Lukasz Lenart <lu...@gmail.com>
Authored: Wed Nov 25 20:37:42 2015 +0100
Committer: Lukasz Lenart <lu...@gmail.com>
Committed: Sat Nov 28 15:36:16 2015 +0100
----------------------------------------------------------------------
plugins/portlet-tiles/pom.xml | 4 ++++
.../struts2/views/tiles/PortletTilesResult.java | 25 +++++++-------------
pom.xml | 5 ++++
3 files changed, 17 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/struts/blob/ddeb7f0f/plugins/portlet-tiles/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/portlet-tiles/pom.xml b/plugins/portlet-tiles/pom.xml
index c2793d7..333c570 100644
--- a/plugins/portlet-tiles/pom.xml
+++ b/plugins/portlet-tiles/pom.xml
@@ -43,6 +43,10 @@
<artifactId>struts2-portlet-plugin</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.tiles</groupId>
+ <artifactId>tiles-portlet</artifactId>
+ </dependency>
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<scope>provided</scope>
http://git-wip-us.apache.org/repos/asf/struts/blob/ddeb7f0f/plugins/portlet-tiles/src/main/java/org/apache/struts2/views/tiles/PortletTilesResult.java
----------------------------------------------------------------------
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 c08a99b..ea134d8 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<String, Object> sessionMap = invocation.getInvocationContext().getSession();
sessionMap.put(PortletConstants.RENDER_DIRECT_LOCATION, location);
http://git-wip-us.apache.org/repos/asf/struts/blob/ddeb7f0f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 6f6ea8a..7f45aea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -680,6 +680,11 @@
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
+ <artifactId>tiles-portlet</artifactId>
+ <version>${tiles.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>${tiles.version}</version>
<scope>runtime</scope>