You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by dd...@apache.org on 2006/11/03 19:05:56 UTC
svn commit: r470930 - in /struts/sandbox/trunk/tiles:
tiles-core/src/main/java/org/apache/tiles/factory/
tiles-test/src/main/java/org/apache/tiles/test/preparer/
tiles-test/src/main/java/org/apache/tiles/test/servlet/
tiles-test/src/main/webapp/ tiles-...
Author: ddewolf
Date: Fri Nov 3 10:05:55 2006
New Revision: 470930
URL: http://svn.apache.org/viewvc?view=rev&rev=470930
Log:
Adding Preparer support and associated functional test
Added:
struts/sandbox/trunk/tiles/tiles-test/src/main/java/org/apache/tiles/test/preparer/
struts/sandbox/trunk/tiles/tiles-test/src/main/java/org/apache/tiles/test/preparer/TestViewPreparer.java (with props)
struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/testinsertdefinition_preparer.jsp (with props)
Modified:
struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java
struts/sandbox/trunk/tiles/tiles-test/src/main/java/org/apache/tiles/test/servlet/IncludingServlet.java
struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/index.jsp
Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java?view=diff&rev=470930&r1=470929&r2=470930
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java (original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/factory/TilesContainerFactory.java Fri Nov 3 10:05:55 2006
@@ -22,6 +22,8 @@
import org.apache.tiles.TilesApplicationContext;
import org.apache.tiles.TilesContainer;
import org.apache.tiles.TilesException;
+import org.apache.tiles.preparer.BasicPreparerFactory;
+import org.apache.tiles.preparer.PreparerFactory;
import org.apache.tiles.context.BasicTilesContextFactory;
import org.apache.tiles.context.TilesContextFactory;
import org.apache.tiles.definition.DefinitionsFactory;
@@ -52,12 +54,16 @@
public static final String DEFINITIONS_FACTORY_INIT_PARAM =
"org.apache.tiles.DEFINITIONS_FACTORY";
+ public static final String PREPARER_FACTORY_INIT_PARAM =
+ "org.apache.tiles.PREPARER_FACTORY";
+
private static final Map DEFAULT_IMPLEMENTATIONS = new HashMap();
static {
DEFAULT_IMPLEMENTATIONS.put(CONTAINER_FACTORY_INIT_PARAM, TilesContainerFactory.class.getName());
DEFAULT_IMPLEMENTATIONS.put(CONTEXT_FACTORY_INIT_PARAM, BasicTilesContextFactory.class.getName());
DEFAULT_IMPLEMENTATIONS.put(DEFINITIONS_FACTORY_INIT_PARAM, UrlDefinitionsFactory.class.getName());
+ DEFAULT_IMPLEMENTATIONS.put(PREPARER_FACTORY_INIT_PARAM, BasicPreparerFactory.class.getName());
}
/**
@@ -91,8 +97,12 @@
DefinitionsFactory defsFactory =
(DefinitionsFactory) createFactory(context, DEFINITIONS_FACTORY_INIT_PARAM);
+ PreparerFactory prepFactory =
+ (PreparerFactory) createFactory(context, PREPARER_FACTORY_INIT_PARAM);
+
container.setDefinitionsFactory(defsFactory);
container.setContextFactory(contextFactory);
+ container.setPreparerFactory(prepFactory);
TilesApplicationContext tilesContext =
contextFactory.createApplicationContext(context);
Added: struts/sandbox/trunk/tiles/tiles-test/src/main/java/org/apache/tiles/test/preparer/TestViewPreparer.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-test/src/main/java/org/apache/tiles/test/preparer/TestViewPreparer.java?view=auto&rev=470930
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-test/src/main/java/org/apache/tiles/test/preparer/TestViewPreparer.java (added)
+++ struts/sandbox/trunk/tiles/tiles-test/src/main/java/org/apache/tiles/test/preparer/TestViewPreparer.java Fri Nov 3 10:05:55 2006
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.tiles.test.preparer;
+
+import org.apache.tiles.preparer.ViewPreparer;
+import org.apache.tiles.TilesRequestContext;
+import org.apache.tiles.ComponentContext;
+import org.apache.tiles.ComponentAttribute;
+
+/**
+ *
+ */
+public class TestViewPreparer implements ViewPreparer {
+
+ public void execute(TilesRequestContext tilesContext, ComponentContext componentContext)
+ throws Exception {
+ componentContext.putAttribute(
+ "body",
+ new ComponentAttribute("This is the value added by the ViewPreparer"));
+ }
+}
Propchange: struts/sandbox/trunk/tiles/tiles-test/src/main/java/org/apache/tiles/test/preparer/TestViewPreparer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/sandbox/trunk/tiles/tiles-test/src/main/java/org/apache/tiles/test/preparer/TestViewPreparer.java
------------------------------------------------------------------------------
svn:keywords = Id Author Date Rev
Modified: struts/sandbox/trunk/tiles/tiles-test/src/main/java/org/apache/tiles/test/servlet/IncludingServlet.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-test/src/main/java/org/apache/tiles/test/servlet/IncludingServlet.java?view=diff&rev=470930&r1=470929&r2=470930
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-test/src/main/java/org/apache/tiles/test/servlet/IncludingServlet.java (original)
+++ struts/sandbox/trunk/tiles/tiles-test/src/main/java/org/apache/tiles/test/servlet/IncludingServlet.java Fri Nov 3 10:05:55 2006
@@ -1,21 +1,22 @@
/*
- * $Id$
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*
- * Copyright 1999-2006 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
*/
-
package org.apache.tiles.test.servlet;
import java.io.IOException;
Modified: struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml?view=diff&rev=470930&r1=470929&r2=470930
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml (original)
+++ struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml Fri Nov 3 10:05:55 2006
@@ -48,4 +48,10 @@
</putList>
</definition>
+ <definition name="preparer.definition" template="/layout.jsp">
+ <put name="title" value="This is the title."/>
+ <put name="header" value="/header.jsp"/>
+ </definition>
+
+
</tiles-definitions>
Modified: struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/index.jsp?view=diff&rev=470930&r1=470929&r2=470930
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/index.jsp (original)
+++ struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/index.jsp Fri Nov 3 10:05:55 2006
@@ -26,6 +26,7 @@
<h2>Currently working tests</h2>
<a href="testinsertdefinition.jsp">Test Insert Configured Definition</a><br/>
+ <a href="testinsertdefinition_preparer.jsp">Test Insert Configured Definition with Preparer</a><br/>
<a href="testinsertdefinition_classpath.jsp">Test Insert Configured Classpath Definition</a><br/>
<a href="testinsertdefinition_notype.jsp">Test Insert Configured Definition with no type specified</a><br/>
<a href="testinsertdefinition_override.jsp">Test Insert Configured Definition with an overridden content</a><br/>
Added: struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/testinsertdefinition_preparer.jsp
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/testinsertdefinition_preparer.jsp?view=auto&rev=470930
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/testinsertdefinition_preparer.jsp (added)
+++ struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/testinsertdefinition_preparer.jsp Fri Nov 3 10:05:55 2006
@@ -0,0 +1,3 @@
+<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
+
+<tiles:insertDefinition name="preparer.definition" preparer="org.apache.tiles.test.preparer.TestViewPreparer" />
Propchange: struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/testinsertdefinition_preparer.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: struts/sandbox/trunk/tiles/tiles-test/src/main/webapp/testinsertdefinition_preparer.jsp
------------------------------------------------------------------------------
svn:keywords = Id Author Date Rev