You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2003/01/22 17:51:19 UTC
cvs commit: jakarta-tapestry/web new.html
hlship 2003/01/22 08:51:19
Modified: junit/src/net/sf/tapestry/junit/mock MockTester.java
MockTestCase.java
doc/src/common TapestryLinks.xml
doc/src/UsersGuide spec.xml configuration.xml
web new.html
Added: junit/src/net/sf/tapestry/junit/mock
TestTemplateExtension.xml
junit/context8/WEB-INF ext.application Two.page
junit/context8 Two.phtml Home.thtml
Log:
Allow override of default template extension.
Revision Changes Path
1.12 +11 -1 jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/MockTester.java
Index: MockTester.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/MockTester.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- MockTester.java 17 Jan 2003 17:41:29 -0000 1.11
+++ MockTester.java 22 Jan 2003 16:51:17 -0000 1.12
@@ -72,6 +72,7 @@
import net.sf.tapestry.DefaultResourceResolver;
import net.sf.tapestry.IResourceLocation;
import net.sf.tapestry.IResourceResolver;
+import net.sf.tapestry.Tapestry;
import net.sf.tapestry.resource.ClasspathResourceLocation;
import net.sf.tapestry.util.xml.DocumentParseException;
import ognl.Ognl;
@@ -504,6 +505,9 @@
String name = a.getAttributeValue("name");
String pattern = a.getTextTrim();
+ if (Tapestry.isNull(pattern))
+ throw new DocumentParseException("Pattern is null in " + a);
+
if (outputString == null)
outputString = _response.getOutputString();
@@ -535,6 +539,9 @@
String name = a.getAttributeValue("name");
String substring = a.getTextTrim();
+ if (Tapestry.isNull(substring))
+ throw new DocumentParseException("Substring is null in " + a);
+
if (outputString == null)
outputString = _response.getOutputString();
@@ -630,6 +637,9 @@
int subgroup = (value == null) ? 0 : Integer.parseInt(value);
String pattern = element.getTextTrim();
+
+ if (Tapestry.isNull(pattern))
+ throw new DocumentParseException("Pattern is null in " + element);
PatternMatcherInput input = new PatternMatcherInput(outputString);
1.13 +12 -1 jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/MockTestCase.java
Index: MockTestCase.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/MockTestCase.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- MockTestCase.java 17 Jan 2003 17:41:28 -0000 1.12
+++ MockTestCase.java 22 Jan 2003 16:51:17 -0000 1.13
@@ -95,6 +95,17 @@
// in a static suite() method.
+ /**
+ * Tests ability to override default template extension.
+ *
+ **/
+
+ public void testTemplateExtension()
+ throws Exception
+ {
+ attempt("TestTemplateExtension.xml");
+ }
+
/**
* Tests related to the listener binding (added in 1.4 DTD).
*
1.1 jakarta-tapestry/junit/src/net/sf/tapestry/junit/mock/TestTemplateExtension.xml
Index: TestTemplateExtension.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: TestTemplateExtension.xml,v 1.1 2003/01/22 16:51:17 hlship Exp $ -->
<mock-test>
<context name="c8" root="context8"/>
<servlet name="ext" class="net.sf.tapestry.ApplicationServlet"/>
<request>
<assert-output name="Home Page Content">
This is the Home page, with template Home.thtml.
</assert-output>
</request>
<request>
<parameter name="service" value="page"/>
<parameter name="context" value="Two"/>
<assert-output name="Page Two Content">
This is the Two page, with template Two.phtml.
</assert-output>
</request>
</mock-test>
1.1 jakarta-tapestry/junit/context8/WEB-INF/ext.application
Index: ext.application
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: ext.application,v 1.1 2003/01/22 16:51:18 hlship Exp $ -->
<!DOCTYPE application PUBLIC
"-//Howard Lewis Ship//Tapestry Specification 1.4//EN"
"http://tapestry.sf.net/dtd/Tapestry_1_4.dtd">
<application>
<property name="net.sf.tapestry.template-extension" value="thtml"/>
</application>
1.1 jakarta-tapestry/junit/context8/WEB-INF/Two.page
Index: Two.page
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: Two.page,v 1.1 2003/01/22 16:51:18 hlship Exp $ -->
<!DOCTYPE page-specification PUBLIC
"-//Howard Lewis Ship//Tapestry Specification 1.4//EN"
"http://tapestry.sf.net/dtd/Tapestry_1_4.dtd">
<page-specification>
<property name="net.sf.tapestry.template-extension" value="phtml"/>
</page-specification>
1.1 jakarta-tapestry/junit/context8/Two.phtml
Index: Two.phtml
===================================================================
<html jwcid="@Shell" title="Home">
<body jwcid="@Body">
This is the Two page, with template Two.phtml.
</body>
</html>
1.1 jakarta-tapestry/junit/context8/Home.thtml
Index: Home.thtml
===================================================================
<html jwcid="@Shell" title="Home">
<body jwcid="@Body">
This is the Home page, with template Home.thtml.
</body>
</html>
1.21 +2 -1 jakarta-tapestry/doc/src/common/TapestryLinks.xml
Index: TapestryLinks.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/doc/src/common/TapestryLinks.xml,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- TapestryLinks.xml 17 Jan 2003 17:38:44 -0000 1.20
+++ TapestryLinks.xml 22 Jan 2003 16:51:19 -0000 1.21
@@ -7,6 +7,7 @@
<!-- Classes provided by Sun -->
<!ENTITY Double "<classname>Double</classname>">
+<!ENTITY HashMap "<classname>HashMap</classname>">
<!ENTITY HttpServletRequest "<classname>HttpServletRequest</classname>">
<!ENTITY HttpSession "<classname>HttpSession</classname>">
<!ENTITY Integer "<classname>Integer</classname>">
1.3 +29 -8 jakarta-tapestry/doc/src/UsersGuide/spec.xml
Index: spec.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/doc/src/UsersGuide/spec.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- spec.xml 17 Jan 2003 17:38:44 -0000 1.2
+++ spec.xml 22 Jan 2003 16:51:19 -0000 1.3
@@ -275,6 +275,13 @@
the OGNL expression <literal>bindings.<replaceable>name</replaceable></literal>.
</para>
+<para>
+If the <literal>expression</literal> attribute is omitted, then
+the body of the element is used. This is useful when the
+expression is long, or contains problematic characters (such as a mix
+of single and double quotes).
+</para>
+
<figure>
<title><sgmltag class="starttag">binding</sgmltag> Attributes</title>
@@ -500,8 +507,9 @@
<entry>string</entry>
<entry>yes</entry>
<entry/>
- <entry>The complete resource path to the component's specification (including leading
- slash and file extension).</entry>
+ <entry>An absolute or relative resource path to the component's specification (including leading
+ slash and file extension). Relative resources are evaluated relative to
+ the location of the containing application or library specfication.</entry>
</row>
</tbody>
</tgroup>
@@ -613,6 +621,13 @@
may be accessed using the OGNL expression <literal>assets.<replaceable>name</replaceable></literal>.
</para>
+<para>
+The path may be either absolute or relative. Absolute paths start with a leading slash, and are evalulated
+relative to the context root. Relative paths are evaluated relative to the application root, which
+is typically the same as the context root (the exception being a WAR that contains multiple
+Tapestry applications, within multiple subfolders).
+</para>
+
<figure>
<title><sgmltag class="starttag">context-asset</sgmltag> Attributes</title>
<informaltable>
@@ -639,8 +654,7 @@
<entry>string</entry>
<entry>yes</entry>
<entry/>
- <entry>The path to the asset, assuming a root directory matching the servlet context
- root directory. The path should begin with leading forward slash.
+ <entry>The path to the asset.
</entry>
</row>
</tbody>
@@ -662,7 +676,7 @@
by an intelligent IDE to provide help. The Tapestry Inspector may also display a description.
</para>
-<note>
+<warning>
<para>
The DTD supports multiple <sgmltag class="starttag">description</sgmltag> elements, each
localized to a different language. In practice, a single description, in English, is typically
@@ -670,7 +684,7 @@
it is probably safest to expect just a single <sgmltag class="starttag">description</sgmltag> tag
to be allowed in the next revision of the DTD.
</para>
-</note>
+</warning>
<para>
The descriptive text appears inside the <sgmltag class="starttag">description</sgmltag> tags. Leading
@@ -1281,6 +1295,13 @@
may be accessed using the OGNL expression <literal>assets.<replaceable>name</replaceable></literal>.
</para>
+<para>
+The resource path may either be complete and absolute, and start with a leading slash,
+or be relative. Relative paths are evaluated relative to the location of the
+containing specification.
+</para>
+
+
<figure>
<title><sgmltag class="starttag">private-asset</sgmltag> Attributes</title>
<informaltable>
@@ -1307,7 +1328,7 @@
<entry>string</entry>
<entry>yes</entry>
<entry/>
- <entry>The path to the asset on the classpath. The path should begin with leading forward slash.
+ <entry>The absolute or relative path to the asset on the classpath.
</entry>
</row>
</tbody>
1.3 +29 -3 jakarta-tapestry/doc/src/UsersGuide/configuration.xml
Index: configuration.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/doc/src/UsersGuide/configuration.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- configuration.xml 17 Jan 2003 17:38:44 -0000 1.2
+++ configuration.xml 22 Jan 2003 16:51:19 -0000 1.3
@@ -204,6 +204,27 @@
<title>Configuration Values</title>
<varlistentry>
+ <term>net.sf.tapestry.template-extension</term>
+
+ <listitem>
+ <para>
+ Overrides the default extension used to locate templates for pages or components.
+ The default extension is "html", this configuration property
+ allows overrides where appropriate. For example,
+ an application that produces WML may want to override this to "wml".
+ </para>
+
+ <para>
+ This configuration property does not follow the normal search path rules. The
+ &spec.property; must be provided in the &spec.page-specification; or &spec.component-specification;.
+ If no value is found there, the immediate containing &spec.application; or
+ &spec.library-specification; is checked. If still not found, the default is used.
+ </para>
+
+ </listitem>
+</varlistentry>
+
+<varlistentry>
<term>net.sf.tapestry.asset.dir</term>
<term>net.sf.tapestry.asset.URL</term>
@@ -226,9 +247,14 @@
<listitem>
<para>
- The class name to instantiate as the
+ The fully qualified class name to instantiate as the
<link linkend="intro.engine-service-visit">Visit object</link>.
</para>
+
+ <para>
+ If not specified, an instance of &HashMap; will be created.
+ </para>
+
</listitem>
</varlistentry>
@@ -305,7 +331,7 @@
</para>
<para>
- This slows down request handling but a significant amount, but is very
+ This slows down request handling by a noticable amount, but is very
useful in devlopment; it means that changes to templates and specifications
are immediately visible to the application. It also helps identify
any errors in managing persistent page state.
1.118 +6 -3 jakarta-tapestry/web/new.html
Index: new.html
===================================================================
RCS file: /home/cvs/jakarta-tapestry/web/new.html,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -r1.117 -r1.118
--- new.html 20 Jan 2003 21:18:04 -0000 1.117
+++ new.html 22 Jan 2003 16:51:19 -0000 1.118
@@ -16,8 +16,11 @@
<ul>
<li>Made improvements to how Tapestry handles
arrays of objects and scalars</li>
- <LI>Upgrade demos to deploy into JBoss 3.0.4</LI>
- <li>Merge in changes from Tapestry 2.3
+<LI>Upgrade demos to deploy into JBoss 3.0.4</LI>
+<li>Merge in changes from Tapestry 2.3</li>
+<li><code><binding></code> elements may now specify the expression as the parsed data</li>
+<li>The template extension may now be overriden using the configuration property <code>net.sf.tapestry.template-extension</code>
+
</ul>
<pre>