Updates Portal Tiles integration

(cherry picked from commit 6edc0ff)
This commit is contained in:
Lukasz Lenart
2015-11-25 20:37:42 +01:00
parent 5d30eb1ad2
commit ddeb7f0f7c
3 changed files with 17 additions and 17 deletions
+4
View File
@@ -42,6 +42,10 @@
<groupId>org.apache.struts</groupId>
<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>
@@ -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);
+5
View File
@@ -678,6 +678,11 @@
<artifactId>tiles-servlet</artifactId>
<version>${tiles.version}</version>
</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>