Author: apetrelli Date: Wed May 23 08:16:35 2007 New Revision: 540974 URL: http://svn.apache.org/viewvc?view=rev&rev=540974 Log: WW-1941 Merge from trunk to STRUTS_2_0_X branch. Updated Struts 2 - Tiles 2 plugin to use Tiles 2.0.3 in trunk. Updated Struts 2 showcase to the changes of Struts 2 - Tiles 2 plugin.
Modified: struts/struts2/branches/STRUTS_2_0_X/apps/showcase/pom.xml struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/webapp/WEB-INF/tiles.xml struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/webapp/WEB-INF/web.xml struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/pom.xml struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesContainerFactory.java struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java Modified: struts/struts2/branches/STRUTS_2_0_X/apps/showcase/pom.xml URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/apps/showcase/pom.xml?view=diff&rev=540974&r1=540973&r2=540974 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/apps/showcase/pom.xml (original) +++ struts/struts2/branches/STRUTS_2_0_X/apps/showcase/pom.xml Wed May 23 08:16:35 2007 @@ -63,6 +63,13 @@ </dependency> <dependency> + <groupId>org.apache.tiles</groupId> + <artifactId>tiles-jsp</artifactId> + <version>2.0.3</version> + <scope>runtime</scope> + </dependency> + + <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-codebehind-plugin</artifactId> <version>${pom.version}</version> Modified: struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/webapp/WEB-INF/tiles.xml URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/webapp/WEB-INF/tiles.xml?view=diff&rev=540974&r1=540973&r2=540974 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/webapp/WEB-INF/tiles.xml (original) +++ struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/webapp/WEB-INF/tiles.xml Wed May 23 08:16:35 2007 @@ -28,15 +28,15 @@ <tiles-definitions> <definition name="showcase.index" template="/tiles/layout.jsp"> - <put name="title" value="Tiles Showcase"/> - <put name="header" value="/tiles/header.jsp"/> - <put name="body" value="/tiles/body.jsp"/> + <put-attribute name="title" value="Tiles Showcase"/> + <put-attribute name="header" value="/tiles/header.jsp"/> + <put-attribute name="body" value="/tiles/body.jsp"/> </definition> <definition name="showcase.freemarker" template="/tiles/layout.jsp"> - <put name="title" value="Tiles/Freemarker Showcase"/> - <put name="header" value="/tiles/header.jsp"/> - <put name="body" value="/tiles/body.ftl"/> + <put-attribute name="title" value="Tiles/Freemarker Showcase"/> + <put-attribute name="header" value="/tiles/header.jsp"/> + <put-attribute name="body" value="/tiles/body.ftl"/> </definition> </tiles-definitions> Modified: struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/webapp/WEB-INF/web.xml URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/webapp/WEB-INF/web.xml?view=diff&rev=540974&r1=540973&r2=540974 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/webapp/WEB-INF/web.xml (original) +++ struts/struts2/branches/STRUTS_2_0_X/apps/showcase/src/main/webapp/WEB-INF/web.xml Wed May 23 08:16:35 2007 @@ -5,11 +5,6 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Struts Showcase Application</display-name> - - <context-param> - <param-name>org.apache.tiles.CONTAINER_FACTORY</param-name> - <param-value>org.apache.struts2.tiles.StrutsTilesContainerFactory</param-value> - </context-param> <filter> <filter-name>struts-cleanup</filter-name> @@ -57,7 +52,7 @@ <listener> <listener-class> - org.apache.tiles.listener.TilesListener + org.apache.struts2.tiles.StrutsTilesListener </listener-class> </listener> Modified: struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/pom.xml URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/pom.xml?view=diff&rev=540974&r1=540973&r2=540974 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/pom.xml (original) +++ struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/pom.xml Wed May 23 08:16:35 2007 @@ -22,7 +22,7 @@ <dependency> <groupId>org.apache.tiles</groupId> <artifactId>tiles-core</artifactId> - <version>2.0-SNAPSHOT</version> + <version>2.0.3</version> </dependency> <dependency> <groupId>javax.servlet</groupId> Modified: struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesContainerFactory.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesContainerFactory.java?view=diff&rev=540974&r1=540973&r2=540974 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesContainerFactory.java (original) +++ struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/src/main/java/org/apache/struts2/tiles/StrutsTilesContainerFactory.java Wed May 23 08:16:35 2007 @@ -29,52 +29,36 @@ import org.apache.tiles.impl.BasicTilesContainer; import org.apache.tiles.preparer.PreparerFactory; -import javax.servlet.jsp.PageContext; import java.util.Map; public class StrutsTilesContainerFactory extends TilesContainerFactory { - /** - * Initialize the container in a struts specific manner. - * - * @param context - * @param container - * @throws TilesException - */ - public void initializeContainer(Object context, - BasicTilesContainer container) - throws TilesException { - - Map<String, String> initParmMap = - TilesContainerFactory.getInitParameterMap(context); - - TilesContextFactory contextFactory = (TilesContextFactory) - TilesContainerFactory.createFactory( - initParmMap, TilesContainerFactory.CONTEXT_FACTORY_INIT_PARAM); + + @Override + protected void storeContainerDependencies(Object context, Map<String, String> initParameters, Map<String, String> configuration, BasicTilesContainer container) throws TilesException { + TilesContextFactory contextFactory = + (TilesContextFactory) createFactory(configuration, + CONTEXT_FACTORY_INIT_PARAM); contextFactory = new StrutsTilesContextFactory(contextFactory); - DefinitionsFactory defsFactory = (DefinitionsFactory) - TilesContainerFactory.createFactory( - initParmMap, - TilesContainerFactory.DEFINITIONS_FACTORY_INIT_PARAM); + DefinitionsFactory defsFactory = + (DefinitionsFactory) createFactory(configuration, + DEFINITIONS_FACTORY_INIT_PARAM); PreparerFactory prepFactory = - (PreparerFactory) TilesContainerFactory.createFactory( - initParmMap, - TilesContainerFactory.PREPARER_FACTORY_INIT_PARAM); + (PreparerFactory) createFactory(configuration, + PREPARER_FACTORY_INIT_PARAM); + contextFactory.init(configuration); TilesApplicationContext tilesContext = - contextFactory.createApplicationContext(context); + contextFactory.createApplicationContext(context); container.setDefinitionsFactory(defsFactory); container.setContextFactory(contextFactory); container.setPreparerFactory(prepFactory); container.setApplicationContext(tilesContext); - - container.init(getInitParameterMap(context)); - } /** @@ -98,13 +82,10 @@ return factory.createApplicationContext(context); } - public TilesRequestContext createRequestContext(TilesApplicationContext tilesApplicationContext, Object request, Object response) { - TilesRequestContext context = factory.createRequestContext(tilesApplicationContext, request, response); - return new StrutsTilesRequestContext(context); - } - - public TilesRequestContext createRequestContext(TilesApplicationContext tilesApplicationContext, PageContext pageContext) { - TilesRequestContext context = factory.createRequestContext(tilesApplicationContext, pageContext); + public TilesRequestContext createRequestContext( + TilesApplicationContext tilesApplicationContext, + Object... requestItems) { + TilesRequestContext context = factory.createRequestContext(tilesApplicationContext, requestItems); return new StrutsTilesRequestContext(context); } } Modified: struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java URL: http://svn.apache.org/viewvc/struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java?view=diff&rev=540974&r1=540973&r2=540974 ============================================================================== --- struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java (original) +++ struts/struts2/branches/STRUTS_2_0_X/plugins/tiles/src/main/java/org/apache/struts2/views/tiles/TilesResult.java Wed May 23 08:16:35 2007 @@ -101,6 +101,6 @@ HttpServletRequest request = ServletActionContext.getRequest(); HttpServletResponse response = ServletActionContext.getResponse(); - container.render(request, response, location); + container.render(location, request, response); } }