mirror of
https://github.com/apache/struts.git
synced 2026-08-07 07:37:20 +00:00
Updates Portal Tiles integration
This commit is contained in:
@@ -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>
|
||||
|
||||
+8
-17
@@ -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);
|
||||
|
||||
@@ -614,6 +614,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>
|
||||
|
||||
Reference in New Issue
Block a user