mirror of
https://github.com/apache/struts.git
synced 2026-08-11 01:27:14 +00:00
Updates Portal Tiles integration
This commit is contained in:
@@ -42,6 +42,10 @@
|
|||||||
<groupId>org.apache.struts</groupId>
|
<groupId>org.apache.struts</groupId>
|
||||||
<artifactId>struts2-portlet-plugin</artifactId>
|
<artifactId>struts2-portlet-plugin</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tiles</groupId>
|
||||||
|
<artifactId>tiles-portlet</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>jsp-api</artifactId>
|
<artifactId>jsp-api</artifactId>
|
||||||
|
|||||||
+8
-17
@@ -9,6 +9,7 @@ import org.apache.struts2.portlet.context.PortletActionContext;
|
|||||||
import org.apache.tiles.TilesContainer;
|
import org.apache.tiles.TilesContainer;
|
||||||
import org.apache.tiles.TilesException;
|
import org.apache.tiles.TilesException;
|
||||||
import org.apache.tiles.access.TilesAccess;
|
import org.apache.tiles.access.TilesAccess;
|
||||||
|
import org.apache.tiles.portlet.context.PortletUtil;
|
||||||
|
|
||||||
import javax.portlet.ActionResponse;
|
import javax.portlet.ActionResponse;
|
||||||
import javax.portlet.PortletException;
|
import javax.portlet.PortletException;
|
||||||
@@ -19,11 +20,13 @@ import java.io.IOException;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JIRA WW-2749 (STRUTS).
|
* Dedicated Tile result to be used in Portlet environment
|
||||||
|
*
|
||||||
|
* WW-2749
|
||||||
*/
|
*/
|
||||||
public class PortletTilesResult extends ServletDispatcherResult {
|
public class PortletTilesResult extends ServletDispatcherResult {
|
||||||
|
|
||||||
private static final long serialVersionUID = -3806939435493086244L;
|
public static final String TILES_ACTION_NAME = "tilesDirect";
|
||||||
|
|
||||||
public PortletTilesResult() {
|
public PortletTilesResult() {
|
||||||
super();
|
super();
|
||||||
@@ -33,10 +36,7 @@ public class PortletTilesResult extends ServletDispatcherResult {
|
|||||||
super(location);
|
super(location);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME PATCH du JIRA WW-2749 (STRUTS)
|
public void doExecute(String location, ActionInvocation invocation) throws Exception {
|
||||||
public void doExecute(String location, ActionInvocation invocation)
|
|
||||||
throws IOException, TemplateException, PortletException, TilesException {
|
|
||||||
|
|
||||||
if (PortletActionContext.getPhase().isAction() || PortletActionContext.getPhase().isEvent()) {
|
if (PortletActionContext.getPhase().isAction() || PortletActionContext.getPhase().isEvent()) {
|
||||||
executeActionResult(location, invocation);
|
executeActionResult(location, invocation);
|
||||||
} else {
|
} else {
|
||||||
@@ -44,15 +44,10 @@ public class PortletTilesResult extends ServletDispatcherResult {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param location
|
|
||||||
* @throws TilesException
|
|
||||||
*/
|
|
||||||
protected void executeRenderResult(String location) throws TilesException {
|
protected void executeRenderResult(String location) throws TilesException {
|
||||||
setLocation(location);
|
setLocation(location);
|
||||||
|
|
||||||
ServletContext servletContext = ServletActionContext.getServletContext();
|
TilesContainer container = PortletUtil.getContainer(PortletActionContext.getPortletContext());
|
||||||
TilesContainer container = TilesAccess.getContainer(servletContext);
|
|
||||||
|
|
||||||
HttpServletRequest request = ServletActionContext.getRequest();
|
HttpServletRequest request = ServletActionContext.getRequest();
|
||||||
HttpServletResponse response = ServletActionContext.getResponse();
|
HttpServletResponse response = ServletActionContext.getResponse();
|
||||||
@@ -60,14 +55,10 @@ public class PortletTilesResult extends ServletDispatcherResult {
|
|||||||
container.render(location, request, response);
|
container.render(location, request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param location
|
|
||||||
* @param invocation
|
|
||||||
*/
|
|
||||||
protected void executeActionResult(String location, ActionInvocation invocation) {
|
protected void executeActionResult(String location, ActionInvocation invocation) {
|
||||||
ActionResponse res = PortletActionContext.getActionResponse();
|
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();
|
Map<String, Object> sessionMap = invocation.getInvocationContext().getSession();
|
||||||
sessionMap.put(PortletConstants.RENDER_DIRECT_LOCATION, location);
|
sessionMap.put(PortletConstants.RENDER_DIRECT_LOCATION, location);
|
||||||
|
|||||||
@@ -614,6 +614,11 @@
|
|||||||
<artifactId>tiles-servlet</artifactId>
|
<artifactId>tiles-servlet</artifactId>
|
||||||
<version>${tiles.version}</version>
|
<version>${tiles.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tiles</groupId>
|
||||||
|
<artifactId>tiles-portlet</artifactId>
|
||||||
|
<version>${tiles.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.tiles</groupId>
|
<groupId>org.apache.tiles</groupId>
|
||||||
<artifactId>tiles-jsp</artifactId>
|
<artifactId>tiles-jsp</artifactId>
|
||||||
|
|||||||
Reference in New Issue
Block a user