You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2010/03/07 15:52:52 UTC
svn commit: r920007 - in /tiles/sandbox/trunk/tiles3:
tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/
tiles-jsp/ tiles-jsp/src/main/java/org/apache/tiles/jsp/
tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/ tiles-jsp/src/main/...
Author: apetrelli
Date: Sun Mar 7 14:52:51 2010
New Revision: 920007
URL: http://svn.apache.org/viewvc?rev=920007&view=rev
Log:
TILESSB-25
Created Mojo for JSP support.
TILESSB-21
TILESSB-22
TILESSB-24
Improved code to work.
TILES-500
Added support for "flush" attribute.
Added:
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/resources/META-INF/tld/tiles-extras-jsp.tld
- copied, changed from r918676, tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/resources/META-INF/tld/tiles-jsp.tld
Removed:
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/JspUtil.java
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddAttributeTag.java
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/AddListAttributeTag.java
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/GetAsStringTag.java
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/ImportAttributeTag.java
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertAttributeTag.java
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertDefinitionTag.java
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertTemplateTag.java
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutAttributeTag.java
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/PutListAttributeTag.java
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/TilesJspException.java
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/definition/
tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/resources/META-INF/tld/tiles-jsp.tld
tiles/sandbox/trunk/tiles3/tiles-jsp/src/test/java/org/
Modified:
tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertAttributeFMModel.java
tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertDefinitionFMModel.java
tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertTemplateFMModel.java
tiles/sandbox/trunk/tiles3/tiles-jsp/pom.xml
tiles/sandbox/trunk/tiles3/tiles-template/pom.xml
tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/DefinitionModel.java
tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java
tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertAttributeModel.java
tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertDefinitionModel.java
tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertTemplateModel.java
tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java
tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutListAttributeModel.java
tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertAttributeModelTest.java
tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertDefinitionModelTest.java
tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertTemplateModelTest.java
tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/pom.xml
tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/layout_flush.ftl
tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/testinsertdefinition_flush.ftl
tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/testput_flush.ftl
tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/velocity/layout_flush.vm
tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/velocity/testinsertdefinition_flush.vm
tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeDirective.java
tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionDirective.java
tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateDirective.java
Modified: tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertAttributeFMModel.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertAttributeFMModel.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertAttributeFMModel.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertAttributeFMModel.java Sun Mar 7 14:52:51 2010
@@ -73,6 +73,7 @@
FreeMarkerUtil.getAsString(parms.get("defaultValueType")),
FreeMarkerUtil.getAsString(parms.get("name")),
(Attribute) FreeMarkerUtil.getAsObject(parms.get("value")),
+ FreeMarkerUtil.getAsBoolean(parms.get("flush"), false),
request, modelBody);
}
Modified: tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertDefinitionFMModel.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertDefinitionFMModel.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertDefinitionFMModel.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertDefinitionFMModel.java Sun Mar 7 14:52:51 2010
@@ -64,12 +64,14 @@
@Override
public void execute(Map<String, TemplateModel> parms, Request request,
ModelBody modelBody) throws IOException {
- model.execute(FreeMarkerUtil.getAsString(parms.get("name")), FreeMarkerUtil.getAsString(parms.get("template")),
+ model.execute(FreeMarkerUtil.getAsString(parms.get("name")),
+ FreeMarkerUtil.getAsString(parms.get("template")),
FreeMarkerUtil.getAsString(parms.get("templateType")),
FreeMarkerUtil.getAsString(parms.get("templateExpression")),
- FreeMarkerUtil.getAsString(parms.get("role")),
- FreeMarkerUtil
- .getAsString(parms.get("preparer")), request, modelBody);
+ FreeMarkerUtil.getAsString(parms.get("role")), FreeMarkerUtil
+ .getAsString(parms.get("preparer")), FreeMarkerUtil
+ .getAsBoolean(parms.get("flush"), false), request,
+ modelBody);
}
}
Modified: tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertTemplateFMModel.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertTemplateFMModel.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertTemplateFMModel.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-freemarker/src/main/java/org/apache/tiles/freemarker/template/InsertTemplateFMModel.java Sun Mar 7 14:52:51 2010
@@ -67,9 +67,10 @@
model.execute(FreeMarkerUtil.getAsString(parms.get("template")),
FreeMarkerUtil.getAsString(parms.get("templateType")),
FreeMarkerUtil.getAsString(parms.get("templateExpression")),
- FreeMarkerUtil.getAsString(parms.get("role")),
- FreeMarkerUtil.getAsString(parms.get("preparer")),
- request, modelBody);
+ FreeMarkerUtil.getAsString(parms.get("role")), FreeMarkerUtil
+ .getAsString(parms.get("preparer")), FreeMarkerUtil
+ .getAsBoolean(parms.get("flush"), false), request,
+ modelBody);
}
}
Modified: tiles/sandbox/trunk/tiles3/tiles-jsp/pom.xml
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-jsp/pom.xml?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-jsp/pom.xml (original)
+++ tiles/sandbox/trunk/tiles3/tiles-jsp/pom.xml Sun Mar 7 14:52:51 2010
@@ -78,6 +78,22 @@
</archive>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.tiles.autotag.plugin</groupId>
+ <artifactId>maven-autotag-plugin</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-jsp</goal>
+ </goals>
+ <configuration>
+ <taglibURI>http://tiles.apache.org/tags-tiles</taglibURI>
+ <packageName>org.apache.tiles.jsp.taglib</packageName>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
@@ -152,9 +168,9 @@
</dependency>
<dependency>
- <groupId>org.apache.tiles</groupId>
- <artifactId>tiles-request-jsp</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <groupId>org.apache.tiles</groupId>
+ <artifactId>tiles-request-jsp</artifactId>
+ <version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
Copied: tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/resources/META-INF/tld/tiles-extras-jsp.tld (from r918676, tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/resources/META-INF/tld/tiles-jsp.tld)
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/resources/META-INF/tld/tiles-extras-jsp.tld?p2=tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/resources/META-INF/tld/tiles-extras-jsp.tld&p1=tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/resources/META-INF/tld/tiles-jsp.tld&r1=918676&r2=920007&rev=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/resources/META-INF/tld/tiles-jsp.tld (original)
+++ tiles/sandbox/trunk/tiles3/tiles-jsp/src/main/resources/META-INF/tld/tiles-extras-jsp.tld Sun Mar 7 14:52:51 2010
@@ -31,747 +31,8 @@
]]>
</description>
<tlib-version>1.2</tlib-version>
- <short-name>tiles</short-name>
- <uri>http://tiles.apache.org/tags-tiles</uri>
- <tag>
- <description>
- <![CDATA[
- <p><strong>Insert a template.</strong></p>
- <p>Insert a template with the possibility to pass
- parameters (called attributes).
- A template can be seen as a procedure that can take parameters or attributes.
- <code><tiles:insertTemplate></code> allows to define these attributes
- and pass them to the inserted jsp page, called template.
- Attributes are defined using nested tag
- <code><tiles:putAttribute></code> or
- <code><tiles:putListAttribute></code>.
- </p>
- <p>You must specify <code>template</code> attribute, for inserting a template</p>
-
- <p><strong>Example : </strong></p>
- <pre>
- <code>
- <tiles:insertTemplate template="/basic/myLayout.jsp" flush="true">
- <tiles:putAttribute name="title" value="My first page" />
- <tiles:putAttribute name="header" value="/common/header.jsp" />
- <tiles:putAttribute name="footer" value="/common/footer.jsp" />
- <tiles:putAttribute name="menu" value="/basic/menu.jsp" />
- <tiles:putAttribute name="body" value="/basic/helloBody.jsp" />
- </tiles:insertTemplate>
- </code>
- </pre>
- ]]>
- </description>
- <name>insertTemplate</name>
- <tag-class>org.apache.tiles.jsp.taglib.InsertTemplateTag</tag-class>
- <body-content>scriptless</body-content>
- <attribute>
- <description>
- <![CDATA[
- <p>A string representing the URI of a template (for example, a JSP
- page).
- </p>
- ]]>
- </description>
- <name>template</name>
- <required>true</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>The type of the template attribute.</p>
- ]]>
- </description>
- <name>templateType</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>The expression to evaluate to get the value of the template.
- </p>
- <p>If used together with <code>template</code>, this attribute will be ignored.</p>
- ]]>
- </description>
- <name>templateExpression</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>True or false. If true, current page out stream is flushed
- before insertion.</p>
- ]]>
- </description>
- <name>flush</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>If this attribute is set to true, and the attribute specified by the
- name does not exist, simply return without writing anything. The
- default value is false, which will cause a runtime exception to be
- thrown.</p>
- ]]>
- </description>
- <name>ignore</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>If the user is in the specified role, the tag is taken into account;
- otherwise, the tag is ignored (skipped).</p>
- ]]>
- </description>
- <name>role</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
-
- <attribute>
- <description>
- The fully qualified class name of the preparer.
- </description>
- <name>preparer</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- </tag>
- <tag>
- <description>
- <![CDATA[
- <p><strong>Insert a definition.</strong></p>
- <p>Insert a definition with the possibility to override and specify
- parameters (called attributes).
- A definition can be seen as a (partially or totally) filled template that
- can override or complete attribute values.
- <code><tiles:insertDefinition></code> allows to define these attributes
- and pass them to the inserted jsp page, called template.
- Attributes are defined using nested tag <code><tiles:putAttribute></code> or
- <code><tiles:putListAttribute></code>.
- </p>
- <p>You must specify <code>name</code> tag attribute, for inserting a definition from
- definitions factory.</p>
- <p><strong>Example : </strong></p>
- <pre>
- <code>
- <tiles:insertDefinition name=".my.tiles.defininition flush="true">
- <tiles:putAttribute name="title" value="My first page" />
- <tiles:putAttribute name="header" value="/common/header.jsp" />
- <tiles:putAttribute name="footer" value="/common/footer.jsp" />
- <tiles:putAttribute name="menu" value="/basic/menu.jsp" />
- <tiles:putAttribute name="body" value="/basic/helloBody.jsp" />
- </tiles:insertDefinition>
- </code>
- </pre>
- ]]>
- </description>
- <name>insertDefinition</name>
- <tag-class>org.apache.tiles.jsp.taglib.InsertDefinitionTag</tag-class>
- <body-content>scriptless</body-content>
- <attribute>
- <description>
- <![CDATA[
- <p>Name of the definition to insert.</p>
- ]]>
- </description>
- <name>name</name>
- <required>true</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>A string representing the URI of a template (for example, a JSP
- page) that will override the one used by the definition itself.
- </p>
- ]]>
- </description>
- <name>template</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>The type of the template attribute.</p>
- ]]>
- </description>
- <name>templateType</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>The expression to evaluate to get the value of the template.
- </p>
- <p>If used together with <code>template</code>, this attribute will be ignored.</p>
- ]]>
- </description>
- <name>templateExpression</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>True or false. If true, current page out stream is flushed
- before insertion.</p>
- ]]>
- </description>
- <name>flush</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>If this attribute is set to true, and the attribute specified by the
- name does not exist, simply return without writing anything. The
- default value is false, which will cause a runtime exception to be
- thrown.</p>
- ]]>
- </description>
- <name>ignore</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>If the user is in the specified role, the tag is taken into account;
- otherwise, the tag is ignored (skipped).</p>
- ]]>
- </description>
- <name>role</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
-
- <attribute>
- <description>
- The fully qualified class name of preparer.
- </description>
- <name>preparer</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- </tag>
- <tag>
- <description>
- <![CDATA[
- <p><strong>Inserts the value of an attribute into the page.</strong></p>
- <p>This tag can be flexibly used to insert the value of an attribute into a page.
- As in other usages in Tiles, every attribute can be determined to have a "type",
- either set explicitly when it was defined, or "computed". If the type is not explicit, then
- if the attribute value is a valid definition, it will be inserted as such. Otherwise,
- if it begins with a "/" character, it will be treated as a "template". Finally, if it
- has not otherwise been assigned a type, it will be treated as a String and included without
- any special handling.</p>
-
- <p><strong>Example : </strong></p>
- <pre>
- <code>
- <tiles:insertAttribute name="body" />
- </code>
- </pre>
- ]]>
- </description>
- <name>insertAttribute</name>
- <tag-class>org.apache.tiles.jsp.taglib.InsertAttributeTag</tag-class>
- <body-content>scriptless</body-content>
- <attribute>
- <description>
- <![CDATA[
- <p>Name of the attribute to insert. This attribute will be ignored if
- the <code>value</code> attribute is specified.</p>
- ]]>
- </description>
- <name>name</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>Attribute object to render directly. If it specified, the <code>name</code>
- attribute will be ignored.</p>
- ]]>
- </description>
- <name>value</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- <type>org.apache.tiles.Attribute</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>True or false. If true, current page out stream is flushed
- before insertion.</p>
- ]]>
- </description>
- <name>flush</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>If this attribute is set to true, and the attribute specified by the
- name does not exist, simply return without writing anything. The
- default value is false, which will cause a runtime exception to be
- thrown.</p>
- ]]>
- </description>
- <name>ignore</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>If the user is in the specified role, the tag is taken into account;
- otherwise, the tag is ignored (skipped).</p>
- ]]>
- </description>
- <name>role</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- The fully qualified name of the preparer.
- </description>
- <name>preparer</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>This value is evaluated only if <code>value</code> is null and the
- attribute with the associated <code>name</code> is null.</p>
- ]]>
- </description>
- <name>defaultValue</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- <type>java.lang.Object</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>The type of the <code>defaultValue</code>, if it is a string.
- To be used in conjunction with <code>defaultValue</code> attribute.</p>
- ]]>
- </description>
- <name>defaultValueType</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- <type>java.lang.Object</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>The role to check for the default value. If the user is in the specified
- role, the default value is taken into account; otherwise, it is ignored
- (skipped).
- To be used in conjunction with <code>defaultValue</code> attribute.</p>
- ]]>
- </description>
- <name>defaultValueRole</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- <type>java.lang.Object</type>
- </attribute>
- </tag>
- <tag>
- <description>
- <![CDATA[
- <p><strong>Create a definition at runtime.
- </strong></p>
- <p>Create a new definition at runtime.
- Newly created definition will be available across the entire request.
- </p>]]>
- </description>
- <name>definition</name>
- <tag-class>org.apache.tiles.jsp.taglib.definition.DefinitionTag</tag-class>
- <body-content>scriptless</body-content>
- <attribute>
- <description>
- <![CDATA[
- <p>Specifies the name under which the newly created definition bean
- will be saved.</p>
- ]]>
- </description>
- <name>name</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>A string representing the URI of a template
- (a JSP page).</p>
- ]]>
- </description>
- <name>template</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>Role to check before inserting this definition. If role is not
- defined for current user, definition is not inserted. Checking is
- done at insert time, not during definition process.</p>
- ]]>
- </description>
- <name>role</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>Name of a parent definition that is used to initialize this new
- definition. Parent definition is searched in definitions factory.</p>
- ]]>
- </description>
- <name>extends</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>Specifies the preparer name to use. The specified preparer will
- be executed before rendering this newly created definition.</p>
- ]]>
- </description>
- <name>preparer</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- </tag>
- <tag>
- <description>
- <![CDATA[
- <p><strong>Put an attribute in enclosing attribute container tag.</strong></p>
- <p>
- Enclosing attribute container tag can be :
- <ul>
- <li><initContainer></li>
- <li><definition></li>
- <li><insertAttribute></li>
- <li><insertDefinition></li>
- <li><putListAttribute></li>
- </ul>
- (or any other tag which implements the <code>PutAttributeTagParent</code> interface.
- Exception is thrown if no appropriate tag can be found.</p>
- <p>Put tag can have following atributes :
- <ul>
- <li>name : Name of the attribute</li>
- <li>value : value to put as attribute</li>
- <li>type : value type. Possible type are : string (value is used as direct string),
- template (value is used as a page url to insert),
- definition (value is used as a definition name to insert),
- object (value is used as it is)</li>
- <li>role : Role to check when 'insertAttribute' will be called.</li>
- </ul></p>
- <p>Value can also come from tag body. Tag body is taken into account only if
- value is not set by one of the tag attributes. In this case Attribute type is
- "string", unless tag body define another type.</p>
- ]]>
- </description>
- <name>putAttribute</name>
- <tag-class>org.apache.tiles.jsp.taglib.PutAttributeTag</tag-class>
- <body-content>scriptless</body-content>
- <attribute>
- <description>
- <![CDATA[
- <p>Name of the attribute.</p>
- ]]>
- </description>
- <name>name</name>
- <required>true</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>Attribute value. Could be a String or an Object.</p>
- ]]>
- </description>
- <name>value</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- <type>java.lang.Object</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>The expression to calculate the value from. Use this parameter, or value, or body.</p>
- ]]>
- </description>
- <name>expression</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>Specify content type: string, template or definition.</p>
- <ul>
- <li>string : Content is printed directly.</li>
- <li>template : Content is included from specified URL. Value is used as an URL.</li>
- <li>definition : Value is the name of a definition defined in factory (xml file). Definition will be searched
- in the inserted tile, in a <code><tiles:insertAttribute name="attributeName"></code> tag, where 'attributeName'
- is the name used for this tag.</li>
- <li>object: the value is used as it is.</li>
- </ul>
- ]]>
- </description>
- <name>type</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>
- If the user is in the specified role, the tag is taken into account;
- otherwise, the tag is ignored (skipped).
- </p>
- ]]>
- </description>
- <name>role</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>
- If true, the attribute value will be cascaded to nested templates and
- definitions.
- </p>
- ]]>
- </description>
- <name>cascade</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- <type>boolean</type>
- </attribute>
- </tag>
- <tag>
- <description>
- <![CDATA[
- <p><strong>Declare a list that will be pass as attribute to tile.
- </strong></p>
- <p>Declare a list that will be pass as attribute to tile.
- List elements are added using the tags 'addAttribute' or 'addListAttribute'.
- This tag can only be used inside 'insertTemplate', 'insertDefinition',
- 'definition' tags.</p>
- ]]>
- </description>
- <name>putListAttribute</name>
- <tag-class>org.apache.tiles.jsp.taglib.PutListAttributeTag</tag-class>
- <body-content>scriptless</body-content>
- <attribute>
- <description>
- <![CDATA[
- <p>Name of the list.</p>
- ]]>
- </description>
- <name>name</name>
- <required>true</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>
- If true, the attribute value will be cascaded to nested templates and
- definitions.
- </p>
- ]]>
- </description>
- <name>cascade</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>If true, the attribute will put the elements of the attribute
- with the same name of the parent definition before the ones
- specified here. By default, it is 'false'.</p>
- ]]>
- </description>
- <name>inherit</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- <type>boolean</type>
- </attribute>
- </tag>
- <tag>
- <description>
- <![CDATA[
- <p><strong>Add an element to the surrounding list.
- Equivalent to 'putAttribute', but for list element.</strong></p>
-
- <p>Add an element to the surrounding list.
- This tag can only be used inside 'putListAttribute' or 'addListAttribute' tags.
- Value can come from a direct assignment (value="aValue")</p>
- ]]>
- </description>
- <name>addAttribute</name>
- <tag-class>org.apache.tiles.jsp.taglib.AddAttributeTag</tag-class>
- <body-content>scriptless</body-content>
- <attribute>
- <description>
- <![CDATA[
- <p>Attribute value. Can be a String or Object.</p>
- ]]>
- </description>
- <name>value</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- <type>java.lang.Object</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>The expression to calculate the value from. Use this parameter, or value, or body.</p>
- ]]>
- </description>
- <name>expression</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- <type>java.lang.String</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>Specify content type: string, template or definition.</p>
- <ul>
- <li>string : Content is printed directly.</li>
- <li>template : Content is included from specified URL. Value is used as an URL.</li>
- <li>definition : Value denote a definition defined in factory (xml file). Definition will be searched
- in the inserted tile, in a <code><insertAttribute name="attributeName"></code> tag, where 'attributeName'
- is the name used for this tag.</li>
- <li>object: the value is used as it is.</li>
- </ul>
- ]]>
- </description>
- <name>type</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>If the user is in the specified role, the tag is taken into account;
- otherwise, the tag is ignored (skipped).</p>
- ]]>
- </description>
- <name>role</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- </tag>
- <tag>
- <description>
- <![CDATA[
- <p><strong>Declare a list that will be pass as an attribute.
- </strong></p>
- <p>Declare a list that will be pass as an attribute .
- List elements are added using the tag 'addAttribute' or 'addListAttribute'.
- This tag can only be used inside 'insertTemplate', 'insertDefinition'
- or 'definition' tag.</p>
- ]]>
- </description>
- <name>addListAttribute</name>
- <tag-class>org.apache.tiles.jsp.taglib.AddListAttributeTag</tag-class>
- <body-content>scriptless</body-content>
- </tag>
- <tag>
- <description>
- <![CDATA[
- <p><strong>
- Render the value of the specified template attribute to the current JspWriter
- </strong></p>
-
- <p>Retrieve the value of the specified template attribute
- property, and render it to the current JspWriter as a String.
- The usual toString() conversions is applied on found value.</p>
- <p>Throw a JSPException if named value is not found.</p>
- ]]>
- </description>
- <name>getAsString</name>
- <tag-class>org.apache.tiles.jsp.taglib.GetAsStringTag</tag-class>
- <body-content>empty</body-content>
- <attribute>
- <description>
- <![CDATA[
- <p>Attribute name.</p>
- ]]>
- </description>
- <name>name</name>
- <required>true</required>
- <rtexprvalue>true</rtexprvalue>
- <type>org.apache.tiles.Attribute</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>
- If this attribute is set to true, and the attribute specified by the name
- does not exist, simply return without writing anything. The default value is false, which will
- cause a runtime exception to be thrown.
- </p>
- ]]>
- </description>
- <name>ignore</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- <type>boolean</type>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>
- If the user is in the specified role, the tag is taken into account;
- otherwise, the tag is ignored (skipped).
- </p>
- ]]>
- </description>
- <name>role</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- </tag>
+ <short-name>tilesx</short-name>
+ <uri>http://tiles.apache.org/tags-tiles-extras</uri>
<tag>
<description>
<![CDATA[
@@ -842,136 +103,5 @@
<type>boolean</type>
</attribute>
</tag>
- <tag>
- <description>
- <![CDATA[
- <p><strong>Import attribute(s) in specified context.</strong></p>
- <p>Import attribute(s) to requested scope.
- Attribute name and scope are optional. If not specified, all
- attributes are imported in page scope.
- Once imported, an attribute can be used as any other beans from jsp
- contexts.</p>
- ]]>
- </description>
- <name>importAttribute</name>
- <tag-class>org.apache.tiles.jsp.taglib.ImportAttributeTag</tag-class>
- <body-content>empty</body-content>
- <attribute>
- <description>
- <![CDATA[
- <p>Attribute name. If not specified, all attributes are
- imported.</p>
- ]]>
- </description>
- <name>name</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>Name of the destination bean. If not specified, the name will
- be the same as specified in <code>name</code> attribute</p>
- ]]>
- </description>
- <name>toName</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>Scope into which attribute is imported. Default to page.</p>
- ]]>
- </description>
- <name>scope</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- </attribute>
- <attribute>
- <description>
- <![CDATA[
- <p>If this attribute is set to true, and the attribute specified by
- the name does not exist, simply return without error. The default
- value is false, which will cause a runtime exception to be thrown.</p>
- ]]>
- </description>
- <name>ignore</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- <type>boolean</type>
- </attribute>
- </tag>
- <tag>
- <description>
- <![CDATA[
- <p><strong>THIS TAG HAS BEEN DEPRECATED! Please use TilesInitializer or a
- servlet-based way, like TilesServlet, for initialization!</strong></p>
- <p><strong>Initialize the TilesContainer.</strong></p>
- <p>
- In order to use the Tiles system, a TilesContainer must be instantiated.
- This initialization is generally done by the TilesListener (or perhaps the
- TilesServlet or TilesFilter).
- </p>
- <p>
- If the intialization needs to be dynamic, you can initialize the container using
- this tag. Realize however, that this tag MUST be executed prior to invoking
- any other definitions. Additionally, the initilization may only be done once,
- and any subsequent invocations will be ignored.
- </p>
- ]]>
- </description>
- <name>initContainer</name>
- <tag-class>org.apache.tiles.jsp.taglib.definition.InitContainerTag</tag-class>
- <body-content>scriptless</body-content>
- <attribute>
- <description> <![CDATA[ <p>Container Factory implementation used to instantiate the container.</p> ]]> </description>
- <name>containerFactory</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- <attribute>
- <description> <![CDATA[ <p>The key under which the container will be stored.</p>
- <p>If not defined, the container will be the default container</p> ]]> </description>
- <name>containerKey</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- </tag>
-
- <tag>
- <description>
- <![CDATA[
- <p><strong>Destroy the TilesContainer.</strong></p>
- ]]>
- </description>
- <name>destroyContainer</name>
- <tag-class>org.apache.tiles.jsp.taglib.definition.DestroyContainerTag</tag-class>
- <body-content>empty</body-content>
- <attribute>
- <description> <![CDATA[ <p>The key of the container to destroy.</p>
- <p>If not defined, the destroyed container will be the default container</p> ]]> </description>
- <name>containerKey</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- </tag>
- <tag>
- <description>
- <![CDATA[
- <p><strong>Sets the current Tiles container to use in Tiles tags.</strong></p>
- ]]>
- </description>
- <name>setCurrentContainer</name>
- <tag-class>org.apache.tiles.jsp.taglib.definition.SetCurrentContainerTag</tag-class>
- <body-content>empty</body-content>
- <attribute>
- <description> <![CDATA[ <p>The key of the container that will be set as "current".</p>
- <p>If not defined, the current container will be the default container</p> ]]> </description>
- <name>containerKey</name>
- <required>false</required>
- <rtexprvalue>true</rtexprvalue>
- </attribute>
- </tag>
</taglib>
Modified: tiles/sandbox/trunk/tiles3/tiles-template/pom.xml
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-template/pom.xml?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-template/pom.xml (original)
+++ tiles/sandbox/trunk/tiles3/tiles-template/pom.xml Sun Mar 7 14:52:51 2010
@@ -43,6 +43,9 @@
<goals>
<goal>create-descriptor</goal>
</goals>
+ <configuration>
+ <name>tiles</name>
+ </configuration>
</execution>
</executions>
</plugin>
Modified: tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/DefinitionModel.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/DefinitionModel.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/DefinitionModel.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/DefinitionModel.java Sun Mar 7 14:52:51 2010
@@ -28,6 +28,7 @@
import org.apache.tiles.Definition;
import org.apache.tiles.access.TilesAccess;
import org.apache.tiles.autotag.core.runtime.ModelBody;
+import org.apache.tiles.autotag.core.runtime.annotation.Parameter;
import org.apache.tiles.autotag.core.runtime.composition.ComposeStackUtil;
import org.apache.tiles.mgmt.MutableTilesContainer;
import org.apache.tiles.request.Request;
@@ -65,7 +66,8 @@
* @since 2.2.0
*/
public void execute(String name, String template, String role,
- String extendsParam, String preparer, Request request, ModelBody modelBody) throws IOException {
+ @Parameter(name = "extends") String extendsParam, String preparer,
+ Request request, ModelBody modelBody) throws IOException {
Deque<Object> composeStack = ComposeStackUtil
.getComposeStack(request);
Definition definition = createDefinition(name, template, role,
Modified: tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java Sun Mar 7 14:52:51 2010
@@ -29,6 +29,7 @@
import org.apache.tiles.TilesContainer;
import org.apache.tiles.access.TilesAccess;
import org.apache.tiles.autotag.core.runtime.ModelBody;
+import org.apache.tiles.autotag.core.runtime.annotation.Parameter;
import org.apache.tiles.autotag.core.runtime.composition.ComposeStackUtil;
import org.apache.tiles.request.Request;
import org.slf4j.Logger;
@@ -62,6 +63,15 @@
private AttributeResolver attributeResolver;
/**
+ * Constructor that uses the defaut attribute resolver.
+ *
+ * @since 3.0.0
+ */
+ public GetAsStringModel() {
+ this(new DefaultAttributeResolver());
+ }
+
+ /**
* Constructor.
*
* @param attributeResolver The attribute resolver to use.
@@ -93,10 +103,12 @@
* @throws IOException If an I/O error happens during rendering.
* @since 2.2.0
*/
- public void execute(boolean ignore, String preparer,
- String role, Object defaultValue, String defaultValueRole, String defaultValueType,
- String name, Attribute value, Request request, ModelBody modelBody) throws IOException {
- TilesContainer container = TilesAccess.getCurrentContainer(request);
+ public void execute(boolean ignore, String preparer, String role,
+ Object defaultValue, String defaultValueRole,
+ String defaultValueType, @Parameter(required = true) String name,
+ Attribute value, Request request, ModelBody modelBody)
+ throws IOException {
+ TilesContainer container = TilesAccess.getCurrentContainer(request);
Deque<Object> composeStack = ComposeStackUtil.getComposeStack(request);
Attribute attribute = resolveAttribute(container, ignore, preparer,
role, defaultValue, defaultValueRole, defaultValueType, name,
Modified: tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertAttributeModel.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertAttributeModel.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertAttributeModel.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertAttributeModel.java Sun Mar 7 14:52:51 2010
@@ -74,6 +74,15 @@
private AttributeResolver attributeResolver;
/**
+ * Constructor that uses the defaut attribute resolver.
+ *
+ * @since 3.0.0
+ */
+ public InsertAttributeModel() {
+ this(new DefaultAttributeResolver());
+ }
+
+ /**
* Constructor.
*
* @param attributeResolver The attribute resolver to use.
@@ -98,6 +107,7 @@
* the attribute was not computed.
* @param name The name of the attribute.
* @param value The attribute to use immediately, if not null.
+ * @param flush TODO
* @param request TODO
* @param modelBody TODO
* @param container The Tiles container to use.
@@ -107,7 +117,7 @@
public void execute(boolean ignore, String preparer,
String role, Object defaultValue, String defaultValueRole,
String defaultValueType, String name, Attribute value,
- Request request, ModelBody modelBody) throws IOException {
+ boolean flush, Request request, ModelBody modelBody) throws IOException {
TilesContainer container = TilesAccess.getCurrentContainer(request);
Deque<Object> composeStack = ComposeStackUtil.getComposeStack(request);
Attribute attribute = resolveAttribute(container, ignore, preparer,
@@ -118,6 +128,9 @@
container = TilesAccess.getCurrentContainer(request);
attribute = (Attribute) composeStack.pop();
renderAttribute(container, ignore, attribute, request);
+ if (flush) {
+ request.getWriter().flush();
+ }
}
/**
Modified: tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertDefinitionModel.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertDefinitionModel.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertDefinitionModel.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertDefinitionModel.java Sun Mar 7 14:52:51 2010
@@ -28,6 +28,7 @@
import org.apache.tiles.TilesContainer;
import org.apache.tiles.access.TilesAccess;
import org.apache.tiles.autotag.core.runtime.ModelBody;
+import org.apache.tiles.autotag.core.runtime.annotation.Parameter;
import org.apache.tiles.request.Request;
/**
@@ -80,27 +81,30 @@
* @param preparer The preparer to use to invoke before the definition is
* rendered. If specified, it overrides the preparer specified in the
* definition itself.
+ * @param flush TODO
* @param request TODO
* @param modelBody TODO
* @param container The Tiles container.
* @throws IOException If something goes wrong.
* @since 2.2.0
*/
- public void execute(String definitionName, String template,
- String templateType, String templateExpression, String role,
- String preparer, Request request, ModelBody modelBody) throws IOException {
+ public void execute(
+ @Parameter(name = "name", required = true) String definitionName,
+ String template, String templateType, String templateExpression,
+ String role, String preparer, boolean flush, Request request, ModelBody modelBody)
+ throws IOException {
TilesContainer container = TilesAccess.getCurrentContainer(request);
container.startContext(request);
modelBody.evaluateWithoutWriting();
container = TilesAccess.getCurrentContainer(request);
renderDefinition(container, definitionName, template, templateType,
- templateExpression, role, preparer, request);
+ templateExpression, role, preparer, flush, request);
}
private void renderDefinition(TilesContainer container,
String definitionName, String template, String templateType,
String templateExpression, String role, String preparer,
- Request request) {
+ boolean flush, Request request) throws IOException {
try {
AttributeContext attributeContext = container
.getAttributeContext(request);
@@ -109,6 +113,9 @@
attributeContext.setPreparer(preparer);
attributeContext.setTemplateAttribute(templateAttribute);
container.render(definitionName, request);
+ if (flush) {
+ request.getWriter().flush();
+ }
} finally {
container.endContext(request);
}
Modified: tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertTemplateModel.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertTemplateModel.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertTemplateModel.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/InsertTemplateModel.java Sun Mar 7 14:52:51 2010
@@ -28,6 +28,7 @@
import org.apache.tiles.TilesContainer;
import org.apache.tiles.access.TilesAccess;
import org.apache.tiles.autotag.core.runtime.ModelBody;
+import org.apache.tiles.autotag.core.runtime.annotation.Parameter;
import org.apache.tiles.request.Request;
/**
@@ -78,25 +79,28 @@
* @param preparer The preparer to use to invoke before the definition is
* rendered. If specified, it overrides the preparer specified in the
* definition itself.
+ * @param flush TODO
* @param request TODO
* @param modelBody TODO
* @param container The Tiles container.
* @throws IOException If something goes wrong.
* @since 2.2.0
*/
- public void execute(String template, String templateType, String templateExpression,
- String role, String preparer, Request request, ModelBody modelBody) throws IOException {
+ public void execute(@Parameter(required = true) String template,
+ String templateType, String templateExpression, String role,
+ String preparer, boolean flush, Request request, ModelBody modelBody)
+ throws IOException {
TilesContainer container = TilesAccess.getCurrentContainer(request);
container.startContext(request);
modelBody.evaluateWithoutWriting();
container = TilesAccess.getCurrentContainer(request);
renderTemplate(container, template, templateType, templateExpression,
- role, preparer, request);
+ role, preparer, flush, request);
}
private void renderTemplate(TilesContainer container, String template,
String templateType, String templateExpression, String role,
- String preparer, Request request) {
+ String preparer, boolean flush, Request request) throws IOException {
try {
AttributeContext attributeContext = container
.getAttributeContext(request);
@@ -105,6 +109,9 @@
attributeContext.setPreparer(preparer);
attributeContext.setTemplateAttribute(templateAttribute);
container.renderContext(request);
+ if (flush) {
+ request.getWriter().flush();
+ }
} finally {
container.endContext(request);
}
Modified: tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutAttributeModel.java Sun Mar 7 14:52:51 2010
@@ -30,6 +30,7 @@
import org.apache.tiles.TilesContainer;
import org.apache.tiles.access.TilesAccess;
import org.apache.tiles.autotag.core.runtime.ModelBody;
+import org.apache.tiles.autotag.core.runtime.annotation.Parameter;
import org.apache.tiles.autotag.core.runtime.composition.ComposeStackUtil;
import org.apache.tiles.request.Request;
@@ -88,7 +89,7 @@
* @param composeStack The composing stack.
* @since 2.2.0
*/
- public void execute(String name, Object value,
+ public void execute(@Parameter(required = true) String name, Object value,
String expression, String role, String type, boolean cascade,
Request request, ModelBody modelBody) throws IOException {
Deque<Object> composeStack = ComposeStackUtil.getComposeStack(request);
Modified: tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutListAttributeModel.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutListAttributeModel.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutListAttributeModel.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-template/src/main/java/org/apache/tiles/template/PutListAttributeModel.java Sun Mar 7 14:52:51 2010
@@ -30,6 +30,7 @@
import org.apache.tiles.TilesContainer;
import org.apache.tiles.access.TilesAccess;
import org.apache.tiles.autotag.core.runtime.ModelBody;
+import org.apache.tiles.autotag.core.runtime.annotation.Parameter;
import org.apache.tiles.autotag.core.runtime.composition.ComposeStackUtil;
import org.apache.tiles.request.Request;
@@ -48,8 +49,9 @@
*/
public class PutListAttributeModel {
- public void execute(String name, String role, boolean inherit,
- boolean cascade, Request request, ModelBody modelBody) throws IOException {
+ public void execute(@Parameter(required = true) String name, String role,
+ boolean inherit, boolean cascade, Request request,
+ ModelBody modelBody) throws IOException {
Deque<Object> composeStack = ComposeStackUtil.getComposeStack(request);
ListAttribute listAttribute = new ListAttribute();
listAttribute.setRole(role);
Modified: tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertAttributeModelTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertAttributeModelTest.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertAttributeModelTest.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertAttributeModelTest.java Sun Mar 7 14:52:51 2010
@@ -66,7 +66,7 @@
/**
* Test method for {@link org.apache.tiles.template.InsertAttributeModel
* #execute(boolean, String, String, Object, String, String, String,
- * Attribute, Request, ModelBody)}.
+ * Attribute, boolean, Request, ModelBody)}.
* @throws IOException If something goes wrong.
*/
@Test
@@ -93,7 +93,7 @@
replay(resolver, container, request, applicationContext, modelBody);
model.execute(false, "myPreparer", "myRole", "myDefaultValue", "myDefaultValueRole",
- "myDefaultValueType", "myName", attribute, request, modelBody);
+ "myDefaultValueType", "myName", attribute, false, request, modelBody);
verify(resolver, container, request, applicationContext, modelBody);
}
Modified: tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertDefinitionModelTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertDefinitionModelTest.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertDefinitionModelTest.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertDefinitionModelTest.java Sun Mar 7 14:52:51 2010
@@ -61,7 +61,7 @@
/**
* Test method for {@link org.apache.tiles.template.InsertDefinitionModel
* #execute(java.lang.String, java.lang.String, String,
- * String, java.lang.String, java.lang.String, Request, ModelBody)}.
+ * String, java.lang.String, java.lang.String, boolean, Request, ModelBody)}.
* @throws IOException If something goes wrong.
*/
@Test
@@ -87,7 +87,7 @@
replay(container, attributeContext, request, applicationContext, modelBody);
model.execute("myDefinitionName", "myTemplate", "myTemplateType",
"myTemplateExpression", "myRole", "myPreparer",
- request, modelBody);
+ false, request, modelBody);
verify(container, attributeContext, request, applicationContext, modelBody);
}
Modified: tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertTemplateModelTest.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertTemplateModelTest.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertTemplateModelTest.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-template/src/test/java/org/apache/tiles/template/InsertTemplateModelTest.java Sun Mar 7 14:52:51 2010
@@ -59,7 +59,7 @@
/**
* Test method for {@link org.apache.tiles.template.InsertTemplateModel
- * #execute(String, String, String, String, String, Request, ModelBody)}.
+ * #execute(String, String, String, String, String, boolean, Request, ModelBody)}.
* @throws IOException If something goes wrong.
*/
@Test
@@ -84,8 +84,7 @@
replay(container, attributeContext, request, applicationContext, modelBody);
model.execute("myTemplate", "myTemplateType", "myTemplateExpression",
- "myRole", "myPreparer",
- request, modelBody);
+ "myRole", "myPreparer", false, request, modelBody);
verify(container, attributeContext, request, applicationContext, modelBody);
}
Modified: tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/pom.xml
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/pom.xml?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/pom.xml (original)
+++ tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/pom.xml Sun Mar 7 14:52:51 2010
@@ -115,10 +115,10 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.apache.portals.pluto</groupId>
- <artifactId>pluto-taglib</artifactId>
- <version>2.0.0</version>
- <scope>provided</scope>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>pluto-taglib</artifactId>
+ <version>2.0.0</version>
+ <scope>provided</scope>
</dependency>
</dependencies>
@@ -468,4 +468,4 @@
</releases>
</pluginRepository>
</pluginRepositories>
-</project>
\ No newline at end of file
+</project>
Modified: tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/layout_flush.ftl
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/layout_flush.ftl?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/layout_flush.ftl (original)
+++ tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/layout_flush.ftl Sun Mar 7 14:52:51 2010
@@ -26,9 +26,9 @@
<td bgcolor="Blue"><strong><@tiles.getAsString name="title"/></strong></td>
</tr>
<tr>
- <td><@tiles.insertAttribute name="header" flush="true"/></td>
+ <td><@tiles.insertAttribute name="header" flush=true/></td>
</tr>
<tr>
- <td><@tiles.insertAttribute name="body" flush="true"/></td>
+ <td><@tiles.insertAttribute name="body" flush=true/></td>
</tr>
-</table>
\ No newline at end of file
+</table>
Modified: tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/testinsertdefinition_flush.ftl
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/testinsertdefinition_flush.ftl?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/testinsertdefinition_flush.ftl (original)
+++ tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/testinsertdefinition_flush.ftl Sun Mar 7 14:52:51 2010
@@ -21,4 +21,4 @@
*
*/
-->
-<@tiles.insertDefinition name="freemarker.test.definition.flush" flush="true"/>
+<@tiles.insertDefinition name="freemarker.test.definition.flush" flush=true/>
Modified: tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/testput_flush.ftl
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/testput_flush.ftl?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/testput_flush.ftl (original)
+++ tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/freemarker/testput_flush.ftl Sun Mar 7 14:52:51 2010
@@ -21,8 +21,8 @@
*
*/
-->
-<@tiles.insertTemplate template="/freemarker/layout.ftl" flush="true">
+<@tiles.insertTemplate template="/freemarker/layout.ftl" flush=true>
<@tiles.putAttribute name="title" value="This is the title." />
<@tiles.putAttribute name="header" value="/freemarker/header.ftl" />
<@tiles.putAttribute name="body" value="/freemarker/body.ftl" />
-</...@tiles.insertTemplate>
\ No newline at end of file
+</...@tiles.insertTemplate>
Modified: tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/velocity/layout_flush.vm
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/velocity/layout_flush.vm?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/velocity/layout_flush.vm (original)
+++ tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/velocity/layout_flush.vm Sun Mar 7 14:52:51 2010
@@ -24,9 +24,9 @@
<td bgcolor="Blue"><strong>#tiles_getAsString({"name":"title"})#end</strong></td>
</tr>
<tr>
- <td>#tiles_insertAttribute({"name":"header", "flush":"true"})#end</td>
+ <td>#tiles_insertAttribute({"name":"header", "flush":true})#end</td>
</tr>
<tr>
- <td>#tiles_insertAttribute({"name":"body", "flush":"true"})#end</td>
+ <td>#tiles_insertAttribute({"name":"body", "flush":true})#end</td>
</tr>
-</table>
\ No newline at end of file
+</table>
Modified: tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/velocity/testinsertdefinition_flush.vm
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/velocity/testinsertdefinition_flush.vm?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/velocity/testinsertdefinition_flush.vm (original)
+++ tiles/sandbox/trunk/tiles3/tiles-test-pom/tiles-test/src/main/webapp/velocity/testinsertdefinition_flush.vm Sun Mar 7 14:52:51 2010
@@ -19,4 +19,4 @@
* under the License.
*
*#
-#tiles_insertDefinition({"name":"velocity.test.definition.flush", "flush":"true"})#end
+#tiles_insertDefinition({"name":"velocity.test.definition.flush", "flush":true})#end
Modified: tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeDirective.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeDirective.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeDirective.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertAttributeDirective.java Sun Mar 7 14:52:51 2010
@@ -38,7 +38,7 @@
* ,
* {@link InsertAttributeModel#end(java.util.Stack, org.apache.tiles.TilesContainer, boolean, Object...)}
* and
- * {@link InsertAttributeModel#execute(org.apache.tiles.TilesContainer, boolean, String, String, Object, String, String, String, Attribute, Object...)}
+ * {@link InsertAttributeModel#execute(org.apache.tiles.TilesContainer, boolean, String, String, Object, String, String, String, boolean, Attribute, Object...)}
* .
*
* @version $Rev$ $Date$
@@ -81,13 +81,14 @@
@Override
protected void execute(Map<String, Object> params, Request request,
ModelBody modelBody) throws IOException {
- model.execute(VelocityUtil.toSimpleBoolean(
- (Boolean) params.get("ignore"), false), (String) params
- .get("preparer"), (String) params.get("role"), params
- .get("defaultValue"), (String) params.get("defaultValueRole"),
- (String) params.get("defaultValueType"), (String) params
- .get("name"), (Attribute) params.get("value"),
- request, modelBody);
+ model.execute(VelocityUtil.toSimpleBoolean((Boolean) params
+ .get("ignore"), false), (String) params.get("preparer"),
+ (String) params.get("role"), params.get("defaultValue"),
+ (String) params.get("defaultValueRole"), (String) params
+ .get("defaultValueType"), (String) params.get("name"),
+ (Attribute) params.get("value"), VelocityUtil.toSimpleBoolean(
+ (Boolean) params.get("flush"), false), request,
+ modelBody);
}
}
Modified: tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionDirective.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionDirective.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionDirective.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertDefinitionDirective.java Sun Mar 7 14:52:51 2010
@@ -27,6 +27,7 @@
import org.apache.tiles.autotag.core.runtime.ModelBody;
import org.apache.tiles.request.Request;
import org.apache.tiles.template.InsertDefinitionModel;
+import org.apache.tiles.velocity.context.VelocityUtil;
/**
* Wraps {@link InsertDefinitionModel} to be used in Velocity. For the list of
@@ -35,7 +36,7 @@
* ,
* {@link InsertDefinitionModel#end(org.apache.tiles.TilesContainer, String, String, String, String, String, String, Object...)}
* and
- * {@link InsertDefinitionModel#execute(org.apache.tiles.TilesContainer, String, String, String, String, String, String, Object...)}
+ * {@link InsertDefinitionModel#execute(org.apache.tiles.TilesContainer, String, String, String, String, String, boolean, String, Object...)}
* .
*
* @version $Rev$ $Date$
@@ -77,10 +78,11 @@
@Override
protected void execute(Map<String, Object> params, Request request,
ModelBody modelBody) throws IOException {
- model.execute((String) params.get("name"), (String) params.get("template"),
- (String) params.get("templateType"), (String) params
- .get("templateExpression"),
- (String) params.get("role"), (String) params.get("preparer"),
- request, modelBody);
+ model.execute((String) params.get("name"), (String) params
+ .get("template"), (String) params.get("templateType"),
+ (String) params.get("templateExpression"), (String) params
+ .get("role"), (String) params.get("preparer"),
+ VelocityUtil.toSimpleBoolean((Boolean) params.get("flush"),
+ false), request, modelBody);
}
}
Modified: tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateDirective.java
URL: http://svn.apache.org/viewvc/tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateDirective.java?rev=920007&r1=920006&r2=920007&view=diff
==============================================================================
--- tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateDirective.java (original)
+++ tiles/sandbox/trunk/tiles3/tiles-velocity/src/main/java/org/apache/tiles/velocity/template/InsertTemplateDirective.java Sun Mar 7 14:52:51 2010
@@ -27,6 +27,7 @@
import org.apache.tiles.autotag.core.runtime.ModelBody;
import org.apache.tiles.request.Request;
import org.apache.tiles.template.InsertTemplateModel;
+import org.apache.tiles.velocity.context.VelocityUtil;
/**
* Wraps {@link InsertTemplateModel} to be used in Velocity. For the list of
@@ -35,7 +36,7 @@
* ,
* {@link InsertTemplateModel#end(org.apache.tiles.TilesContainer, String, String, String, String, String, Object...)}
* and
- * {@link InsertTemplateModel#execute(org.apache.tiles.TilesContainer, String, String, String, String, String, Object...)}
+ * {@link InsertTemplateModel#execute(org.apache.tiles.TilesContainer, String, String, String, String, boolean, String, Object...)}
* .
*
* @version $Rev$ $Date$
@@ -81,6 +82,7 @@
.get("templateType"),
(String) params.get("templateExpression"), (String) params
.get("role"), (String) params.get("preparer"),
- request, modelBody);
+ VelocityUtil.toSimpleBoolean((Boolean) params.get("flush"),
+ false), request, modelBody);
}
}