Author: buildbot
Date: Sat Feb 3 16:21:22 2018
New Revision: 1024781
Log:
Production update by buildbot for tapestry
Modified:
websites/production/tapestry/content/annotations.html
websites/production/tapestry/content/assets.html
websites/production/tapestry/content/beaneditform-guide.html
websites/production/tapestry/content/cache/main.pageCache
websites/production/tapestry/content/class-reloading.html
websites/production/tapestry/content/clustering-issues.html
websites/production/tapestry/content/component-classes.html
websites/production/tapestry/content/component-events.html
websites/production/tapestry/content/component-mixins.html
websites/production/tapestry/content/component-parameters.html
websites/production/tapestry/content/component-reference.html
websites/production/tapestry/content/component-rendering.html
websites/production/tapestry/content/component-templates.html
websites/production/tapestry/content/content-type-and-markup.html
websites/production/tapestry/content/css.html
websites/production/tapestry/content/development-dashboard.html
websites/production/tapestry/content/dom.html
websites/production/tapestry/content/environmental-services.html
websites/production/tapestry/content/forms-and-validation.html
websites/production/tapestry/content/https.html
websites/production/tapestry/content/injection.html
websites/production/tapestry/content/integration-testing.html
websites/production/tapestry/content/layout-component.html
websites/production/tapestry/content/localization.html
websites/production/tapestry/content/logging.html
websites/production/tapestry/content/page-life-cycle.html
websites/production/tapestry/content/page-navigation.html
websites/production/tapestry/content/persistent-page-data.html
websites/production/tapestry/content/property-expressions.html
websites/production/tapestry/content/request-processing.html
websites/production/tapestry/content/response-compression.html
websites/production/tapestry/content/security.html
websites/production/tapestry/content/session-storage.html
websites/production/tapestry/content/unit-testing-pages-or-components.html
websites/production/tapestry/content/uploading-files.html
websites/production/tapestry/content/url-rewriting.html
Modified: websites/production/tapestry/content/annotations.html
==============================================================================
--- websites/production/tapestry/content/annotations.html (original)
+++ websites/production/tapestry/content/annotations.html Sat Feb 3 16:21:22
2018
@@ -36,13 +36,26 @@
<div class="wrapper bs">
- <div id="navigation"><div class="nav"><ul class="alternate"><li><a
href="index.html">Home</a></li><li><a href="getting-started.html">Getting
Started</a></li><li><a href="documentation.html">Documentation</a></li><li><a
href="download.html">Download</a></li><li><a
href="about.html">About</a></li><li><a class="external-link"
href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li><li><a
href="community.html">Community</a></li><li><a class="external-link"
href="http://www.apache.org/security/">Security</a></li><li><a
class="external-link" href="http://www.apache.org/">Apache</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></div></div>
+ <div id="navigation"><div class="nav"><ul class="alternate"><li><a
href="index.html">Home</a></li><li><a href="getting-started.html">Getting
Started</a></li><li><a href="documentation.html">Documentation</a></li><li><a
href="download.html">Download</a></li><li><a
href="about.html">About</a></li><li><a class="external-link"
href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li><li><a
href="community.html">Community</a></li><li><a class="external-link"
href="http://www.apache.org/security/">Security</a></li><li><a
class="external-link" href="http://www.apache.org/">Apache</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></div>
+
+</div>
<div id="top">
- <div id="smallbanner"><div class="searchbox"
style="float:right;margin: .3em 1em .1em 1em"><span style="color: #999;
font-size: 90%">Tapestry docs, issues, wikis & blogs:</span><form
enctype="application/x-www-form-urlencoded" method="get"
action="http://tapestry.apache.org/search.html">
- <input type="text" name="q">
- <input type="submit" value="Search">
-</form></div><div class="emblem" style="float:left"><p><a
href="index.html"><span class="confluence-embedded-file-wrapper"><img
class="confluence-embedded-image confluence-external-resource"
src="http://tapestry.apache.org/images/tapestry_small.png"
data-image-src="http://tapestry.apache.org/images/tapestry_small.png"></span></a></p></div><div
class="title" style="float:left; margin: 0 0 0 3em"><h1
id="SmallBanner-PageTitle">Annotations</h1></div></div>
+ <div id="smallbanner"><div class="searchbox"
style="float:right;margin: .3em 1em .1em 1em"><span style="color: #999;
font-size: 90%">Tapestry docs, issues, wikis & blogs:</span>
+<form enctype="application/x-www-form-urlencoded" method="get"
action="http://tapestry.apache.org/search.html">
+ <input type="text" name="q">
+ <input type="submit" value="Search">
+</form>
+
+</div>
+
+
+<div class="emblem" style="float:left"><p><a href="index.html"><span
class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image
confluence-external-resource"
src="http://tapestry.apache.org/images/tapestry_small.png"
data-image-src="http://tapestry.apache.org/images/tapestry_small.png"></span></a></p></div>
+
+
+<div class="title" style="float:left; margin: 0 0 0 3em"><h1
id="SmallBanner-PageTitle">Annotations</h1></div>
+
+</div>
<div class="clearer"></div>
</div>
@@ -54,19 +67,40 @@
</div>
<div id="content">
- <div id="ConfluenceContent"><div class="aui-label"
style="float:right" title="Related Articles"><h3>Related Articles</h3><ul
class="content-by-label"><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="annotations.html">Annotations</a>
- </div> </li><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="component-cheat-sheet.html">Component Cheat Sheet</a>
- </div> </li></ul></div><p> </p><p>Tapestry relies heavily on Java
<strong>annotations</strong> rather than XML files for almost all of its
configuration. (In addition, Tapestry's method naming conventions mean you
don't <em>have</em> to use annotations in many cases.)</p><p>Tapestry
annotations are grouped into several distinct modules according to their
purpose.</p><h2 id="Annotations-TapestryCoreandIoCAnnotations">Tapestry Core
and IoC Annotations</h2><p>The majority of Tapestry annotations (those defined
in the tapestry-core and tapestry-ioc modules) are very specific to Tapestry
components or Tapestry IoC services:</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/package-summary.html">Tapestry
Component Annotations</a></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>intended for use
in page/component/mixin classes</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/annotations/package-summary.html">Tapestry
IoC Annotations</a></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>for use by IoC
services</p></td></tr></tbody></table></div><h2
id="Annotations-Annotationsfordataholdingclasses">Annotations for data holding
classes</h2><p>In addition to the core and IoC annotations, there are a few
annotations intended for data holding classes that are not Tapestry components;
these annotations allow high-level components such as Grid and BeanEditForm to
create powerful user interfaces with out any additional coding. Because these
annotations are separated from the rest of Tapestry, they can be used inside
your data tier classes <em>without</em> having to bring all of Tapestry into
your classpath. This is very useful in multi-tier applications w
here data objects may originate in an application tier (such as a JEE
application server) and travel to the presentation tier (a Tapestry
application).</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/beaneditor/package-summary.html">BeanEditForm
Annotations</a></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>for users of the BeanEditForm and Grid
components</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/hibernate/annotations/package-summary.html">Hibernate
Annotations</a></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>for users of the Tapestry-Hibernate
library</p></td></tr></tbody></table></div><h2
id="Annotations-UpgradeNotes–Release5.0.12">Upgrade Notes – Releas
e 5.0.12</h2><p>The artifact id for the annotations module has changed from
<code>tapestry-annotations</code> to <code>tapestry5-annotations</code>. This
is necessary to support Tapestry 4 and Tapestry 5 applications co-existing
within a single WAR.</p></div>
+ <div id="ConfluenceContent"><div class="aui-label"
style="float:right" title="Related Articles">
+
+
+
+
+
+
+
+
+<h3>Related Articles</h3>
+
+<ul class="content-by-label"><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="annotations.html">Annotations</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="component-cheat-sheet.html">Component Cheat
Sheet</a>
+
+
+ </div>
+ </li></ul>
+</div>
+
+
+<p> </p><p>Tapestry relies heavily on Java <strong>annotations</strong>
rather than XML files for almost all of its configuration. (In addition,
Tapestry's method naming conventions mean you don't <em>have</em> to use
annotations in many cases.)</p><p>Tapestry annotations are grouped into several
distinct modules according to their purpose.</p><h2
id="Annotations-TapestryCoreandIoCAnnotations">Tapestry Core and IoC
Annotations</h2><p>The majority of Tapestry annotations (those defined in the
tapestry-core and tapestry-ioc modules) are very specific to Tapestry
components or Tapestry IoC services:</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/package-summary.html">Tapestry
Component Annotations</a></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>intended for use in page/component/mixin c
lasses</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/annotations/package-summary.html">Tapestry
IoC Annotations</a></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>for use by IoC
services</p></td></tr></tbody></table></div><h2
id="Annotations-Annotationsfordataholdingclasses">Annotations for data holding
classes</h2><p>In addition to the core and IoC annotations, there are a few
annotations intended for data holding classes that are not Tapestry components;
these annotations allow high-level components such as Grid and BeanEditForm to
create powerful user interfaces with out any additional coding. Because these
annotations are separated from the rest of Tapestry, they can be used inside
your data tier classes <em>without</em> having to bring all of Tapestry into
your classpath. This is very useful in multi-tier applications where data
objects may ori
ginate in an application tier (such as a JEE application server) and travel to
the presentation tier (a Tapestry application).</p><div
class="table-wrap"><table class="confluenceTable"><tbody><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/beaneditor/package-summary.html">BeanEditForm
Annotations</a></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>for users of the BeanEditForm and Grid
components</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/hibernate/annotations/package-summary.html">Hibernate
Annotations</a></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>for users of the Tapestry-Hibernate
library</p></td></tr></tbody></table></div><h2
id="Annotations-UpgradeNotes–Release5.0.12">Upgrade Notes – Release
5.0.12</h2><p>The artif
act id for the annotations module has changed from
<code>tapestry-annotations</code> to <code>tapestry5-annotations</code>. This
is necessary to support Tapestry 4 and Tapestry 5 applications co-existing
within a single WAR.</p></div>
</div>
<div class="clearer"></div>
Modified: websites/production/tapestry/content/assets.html
==============================================================================
--- websites/production/tapestry/content/assets.html (original)
+++ websites/production/tapestry/content/assets.html Sat Feb 3 16:21:22 2018
@@ -45,13 +45,26 @@
<div class="wrapper bs">
- <div id="navigation"><div class="nav"><ul class="alternate"><li><a
href="index.html">Home</a></li><li><a href="getting-started.html">Getting
Started</a></li><li><a href="documentation.html">Documentation</a></li><li><a
href="download.html">Download</a></li><li><a
href="about.html">About</a></li><li><a class="external-link"
href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li><li><a
href="community.html">Community</a></li><li><a class="external-link"
href="http://www.apache.org/security/">Security</a></li><li><a
class="external-link" href="http://www.apache.org/">Apache</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></div></div>
+ <div id="navigation"><div class="nav"><ul class="alternate"><li><a
href="index.html">Home</a></li><li><a href="getting-started.html">Getting
Started</a></li><li><a href="documentation.html">Documentation</a></li><li><a
href="download.html">Download</a></li><li><a
href="about.html">About</a></li><li><a class="external-link"
href="http://www.apache.org/licenses/LICENSE-2.0">License</a></li><li><a
href="community.html">Community</a></li><li><a class="external-link"
href="http://www.apache.org/security/">Security</a></li><li><a
class="external-link" href="http://www.apache.org/">Apache</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li><li><a
class="external-link"
href="http://www.apache.org/foundation/thanks.html">Thanks</a></li></ul></div>
+
+</div>
<div id="top">
- <div id="smallbanner"><div class="searchbox"
style="float:right;margin: .3em 1em .1em 1em"><span style="color: #999;
font-size: 90%">Tapestry docs, issues, wikis & blogs:</span><form
enctype="application/x-www-form-urlencoded" method="get"
action="http://tapestry.apache.org/search.html">
- <input type="text" name="q">
- <input type="submit" value="Search">
-</form></div><div class="emblem" style="float:left"><p><a
href="index.html"><span class="confluence-embedded-file-wrapper"><img
class="confluence-embedded-image confluence-external-resource"
src="http://tapestry.apache.org/images/tapestry_small.png"
data-image-src="http://tapestry.apache.org/images/tapestry_small.png"></span></a></p></div><div
class="title" style="float:left; margin: 0 0 0 3em"><h1
id="SmallBanner-PageTitle">Assets</h1></div></div>
+ <div id="smallbanner"><div class="searchbox"
style="float:right;margin: .3em 1em .1em 1em"><span style="color: #999;
font-size: 90%">Tapestry docs, issues, wikis & blogs:</span>
+<form enctype="application/x-www-form-urlencoded" method="get"
action="http://tapestry.apache.org/search.html">
+ <input type="text" name="q">
+ <input type="submit" value="Search">
+</form>
+
+</div>
+
+
+<div class="emblem" style="float:left"><p><a href="index.html"><span
class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image
confluence-external-resource"
src="http://tapestry.apache.org/images/tapestry_small.png"
data-image-src="http://tapestry.apache.org/images/tapestry_small.png"></span></a></p></div>
+
+
+<div class="title" style="float:left; margin: 0 0 0 3em"><h1
id="SmallBanner-PageTitle">Assets</h1></div>
+
+</div>
<div class="clearer"></div>
</div>
@@ -63,46 +76,79 @@
</div>
<div id="content">
- <div id="ConfluenceContent"><p>In Tapestry,
<strong>Assets</strong> are any kind of <em>static</em> content that may be
downloaded to a client web browser, such as images, style sheets and JavaScript
files.</p><div class="aui-label" style="float:right" title="Related
Articles"><h3>Related Articles</h3><ul class="content-by-label"><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="assets.html">Assets</a>
- </div> </li><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="layout-component.html">Layout Component</a>
- </div> </li><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="request-processing.html">Request Processing</a>
- </div> </li><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="configuration.html">Configuration</a>
- </div> </li><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="css.html">CSS</a>
- </div> </li><li>
- <div>
- <span class="icon aui-icon aui-icon-small aui-iconfont-page-default"
title="Page">Page:</span>
- </div>
- <div class="details">
- <a href="legacy-javascript.html">Legacy JavaScript</a>
- </div> </li></ul></div><p>Assets can be in one of three places within a
Tapestry app:</p><ol><li>In the <strong>web application's context
folder</strong>, stored inside the web application WAR file in the usual JEE
fashion. In a project following Maven's directory layout conventions, this
would be src/main/webapp or a subdirectory of it (but <em>not</em> under
src/main/webapp/WEB-INF).</li><li>For Tapestry 5.4 and later: under
<strong><code>META-INF</code></strong><code>, with JavaScript modules under
<strong>META-INF/modules</strong> and other assets under
<strong>META-INF/assets</strong>. This would be
src/main/resources/META-INF/modules
and <code>src/main/resources/META-INF/assets</code> if following Maven
directory conventions.</code></li><li>On the <strong>classpath</strong>, with
your Java class files. <em>This is deprecated in Tapestry 5.4 and later (with a
warning).</em> If following Maven directory conventions, this would correspond
to a package-named subdirecto
ry under src/main/resources/, such as
src/main/resources/com/example/myapp/pages).</li></ol><h3
id="Assets-ReferencingAssetsfromTemplates">Referencing Assets from
Templates</h3><p>For referencing assets from templates, two <a
href="component-parameters.html">binding prefixes</a> exist: "context:" and
"asset:". The "context:" prefix matches assets in the web application's context
folder, and the "asset:" prefix is for assets from the classpath.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width:
1px;"><b>src/main/webapp/com/example/myapp/images/tapestry_banner.gif</b></div><div
class="codeContent panelContent pdl">
+ <div id="ConfluenceContent"><p>In Tapestry,
<strong>Assets</strong> are any kind of <em>static</em> content that may be
downloaded to a client web browser, such as images, style sheets and JavaScript
files.</p><div class="aui-label" style="float:right" title="Related Articles">
+
+
+
+
+
+
+
+
+<h3>Related Articles</h3>
+
+<ul class="content-by-label"><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="assets.html">Assets</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="layout-component.html">Layout Component</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="request-processing.html">Request
Processing</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="configuration.html">Configuration</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="css.html">CSS</a>
+
+
+ </div>
+ </li><li>
+ <div>
+ <span class="icon aui-icon aui-icon-small
aui-iconfont-page-default" title="Page">Page:</span> </div>
+
+ <div class="details">
+ <a href="legacy-javascript.html">Legacy JavaScript</a>
+
+
+ </div>
+ </li></ul>
+</div>
+
+
+<p>Assets can be in one of three places within a Tapestry app:</p><ol><li>In
the <strong>web application's context folder</strong>, stored inside the web
application WAR file in the usual JEE fashion. In a project following Maven's
directory layout conventions, this would be src/main/webapp or a subdirectory
of it (but <em>not</em> under src/main/webapp/WEB-INF).</li><li>For
Tapestry 5.4 and later: under <strong><code>META-INF</code></strong><code>,
with JavaScript modules under <strong>META-INF/modules</strong> and other
assets under <strong>META-INF/assets</strong>. This would be
src/main/resources/META-INF/modules
and <code>src/main/resources/META-INF/assets</code> if following Maven
directory conventions.</code></li><li>On the <strong>classpath</strong>, with
your Java class files. <em>This is deprecated in Tapestry 5.4 and later (with a
warning).</em> If following Maven directory conventions, this would correspond
to a package-named subdirectory under src/main/resourc
es/, such as src/main/resources/com/example/myapp/pages).</li></ol><h3
id="Assets-ReferencingAssetsfromTemplates">Referencing Assets from
Templates</h3><p>For referencing assets from templates, two <a
href="assets.html">binding prefixes</a> exist: "context:" and "asset:". The
"context:" prefix matches assets in the web application's context folder, and
the "asset:" prefix is for assets from the classpath.</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width:
1px;"><b>src/main/webapp/com/example/myapp/images/tapestry_banner.gif</b></div><div
class="codeContent panelContent pdl">
<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><img src="${context:images/tapestry_banner.gif}"/>
</pre>
-</div></div><div class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>This is an example of using a
<em>template expansion</em> inside an ordinary element (rather than a
component).</p></div></div><p>If you don't provide either prefix, "asset:" is
assumed.</p><p>Also note that in older code you may occasionally see
${asset:context:...}. That means the same thing as ${context:...}.</p><h3
id="Assets-AssetsinComponentClasses">Assets in Component Classes</h3><p>Assets
are available to your code as instances of the <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/Asset.html">Asset</a>
interface.</p><p>Components access assets via <a
href="injection.html">injection</a>, using the @<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapest
ry5/ioc/annotations/Inject.html">Inject</a> annotation, which allows Assets to
be injected into components as read-only properties. The path to the resource
is specified using the Path annotation:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><div class="confluence-information-macro
confluence-information-macro-information"><span class="aui-icon aui-icon-small
aui-iconfont-info confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>This is an example of using a
<em>template expansion</em> inside an ordinary element (rather than a
component).</p></div></div><p>If you don't provide either prefix, "asset:" is
assumed.</p><p>Also note that in older code you may occasionally see
${asset:context:...}. That means the same thing as ${context:...}.</p><h3
id="Assets-AssetsinComponentClasses">Assets in Component Classes</h3><p>Assets
are available to your code as instances of the <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/Asset.html">Asset</a>
interface.</p><p>Components access assets via <a
href="assets.html">injection</a>, using the @<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5
/ioc/annotations/Inject.html">Inject</a> annotation, which allows Assets to be
injected into components as read-only properties. The path to the resource is
specified using the Path annotation:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Inject
@Path("context:images/tapestry_banner.gif")
private Asset banner;
@@ -117,7 +163,7 @@ private Asset icon;
@Path("${skin.root}/style.css")
private Asset style;
</pre>
-</div></div><div class="confluence-information-macro
confluence-information-macro-note"><span class="aui-icon aui-icon-small
aui-iconfont-warning confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>The use of the <code>${...</code>}
syntax here is a <em>symbol expansion</em> (because it occurs in an annotation
in Java code), rather than a <em>template expansion</em> (which occurs only in
Tapestry template files).</p></div></div><p>An override of the skin.root symbol
would affect all references to the named asset.</p><h3
id="Assets-LocalizationofAssets">Localization of Assets</h3><p>Main Article: <a
href="localization.html">Localization</a></p><p>Assets are localized; Tapestry
will search for a variation of the file appropriate to the effective locale for
the request. In the previous example, a German user of the application may see
a file named <code>edit_de.png</code> (if such a file exists).</p><h3
id="Assets-NewAssetDomains">New Asset Doma
ins</h3><p>If you wish to create new domains for assets, for example to allow
assets to be stored on the file system or in a database, you may define a new
<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/AssetFactory.html">AssetFactory</a>
and contribute it to the <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/AssetSource.html">AssetSource</a>
service configuration.</p><h3
id="Assets-AssetFingerprinting(Tapestry5.3andearlier)">Asset Fingerprinting
(Tapestry 5.3 and earlier)</h3><p>Tapestry creates a new URL for assets
(whether context or classpath). The URL is of the form
/assets/<strong>version</strong>/<strong>folder</strong>/<strong>path</strong>.</p><ul><li><strong>version</strong>:
Application version number, defined by the
<code>tapestry.application-version</code> symbol in your application module
(normally AppModule.java). The default is a random hex number.</li>
<li><strong>folder</strong>: Identifies the library containing the asset, or
"ctx" for a context asset, or "stack" (used when combining multiple JavaScript
files into a single virtual asset).</li><li><strong>path</strong>: The path
below the root package of the library to the specific asset file.</li></ul><h3
id="Assets-AssetFingerprinting(Tapestry5.4andlater)">Asset Fingerprinting<span
style="line-height: 1.5;"> (Tapestry 5.4 and later)</span></h3><p>Tapestry
5.4 changes how Asset URLs are constructed. The version number is now
a <em>content fingerprint</em>, a hash of the actual content of the
asset.</p><p>Assets get a far-future expires header. It is no longer necessary
or desirable to change the application version number.</p><p>During development
or production, if an asset is changed in any way, it will have a new content
fingerprint and will appear, to the browser, to be an entirely new immutable
resource.</p><h3 id="Assets-CSSLinkRewriting">CSS Link Rewriting</h3><p
>It is frequently the case that CSS files will include links to other files,
>such as background images, using the <code>url</code>() value syntax.
>Under 5.4, the URL for the CSS file and the targeted file would be broken,
>due to the inclusions of the CSS file's content hash fingerprint. To fix
>this, Tapestry parses CSS files, locates the <code>url()</code>
>directives, and rewrites the URLs to be absolute (including the targeted
>file's content hash fingerprint).</p><h3
>id="Assets-PerformanceNotes">Performance Notes</h3><p>Assets are expected to
>be entirely static (not changing while the application is deployed). This
>allows Tapestry to perform some important performance
>optimizations.</p><p>Tapestry GZIP compresses the content of all assets
>– if the asset is compressible, the client supports it, and you don't
><a href="configuration.html">explicitly disable it</a>.</p><p><span
>style="line-height: 1.4285715;">Further, the asset will get a </span><em
>style="line-height:
1.4285715;">far future expires header</em><span style="line-height:
1.4285715;">, which will encourage the client browser to cache the
asset.</span></p><p>You should have an explicit application version number for
any production application. Client browsers will aggressively cache downloaded
assets; they will usually not even send a request to see if the asset has
changed once the asset is downloaded the first time. Because of this it is
<em>very important</em> that each new deployment of your application has a new
<a href="configuration.html">version number</a>, to force existing clients to
re-download all assets.</p><h3 id="Assets-AssetSecurity">Asset
Security</h3><div class="confluence-information-macro
confluence-information-macro-warning"><span class="aui-icon aui-icon-small
aui-iconfont-error confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>This applies to how Tapestry 5.3
and earlier manage classpath assets; Tapestry 5.4 introduces
another system which doesn't have this issue.</p></div></div><p>Because
Tapestry directly exposes files on the classpath to the clients, some thought
has gone into ensuring that malicious clients are not able to download assets
that should not be visible to them.</p><p>First off all, there's a package
limitation: classpath assets are only visible if there's a <a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/LibraryMapping.html">LibraryMapping</a>
for them, and the library mapping substitutes for the initial folders on the
classpath. Since the most secure assets, things like
<code>hibernate.cfg.xml</code> are located in the unnamed package, they are
always off limits.</p><p>But what about other files on the classpath? Imagine
this scenario:</p><ul><li>Your Login page exposes a classpath asset,
<code>icon.png</code>.</li><li><p>A malicious client copies the URL,
<code>/assets/1.0.0/app/pages/icon.png (</code><span style="line-he
ight: 1.4285715;">which would indicate that the Login page is actually inside
a library, which is unlikely. More likely, icon.png is a context asset and the
malicious user guessed the path for Login.class by looking at the Tapestry
source code.) </span><span style="line-height: 1.4285715;">and changes the
file name to </span><code style="line-height:
1.4285715;">Login.class</code><span style="line-height:
1.4285715;">.</span></p></li><li><p>The client decompiles the class file and
spots your secret emergency password: goodbye security! (<span
style="line-height: 1.4285715;">Never create such back doors, of
course!)</span></p></li></ul><p>Fortunately, this can't happen. Files with
extension ".class" are secured; they must be accompanied in the URL with a
query parameter that is the MD5 hash of the file's contents. If the query
parameter is absent, or doesn't match the actual file's content, the request is
rejected.</p><p>When your code exposes an Asset that is secured, Tapestry
generates a URL that automatically includes MD5 hash query parameter. The
malicious user is locked out of access to the files. (The only way they could
generate the MD5 hash is if<span style="line-height: 1.4285715;"> they somehow
already have the files, in which case they don't need to download them again
anyway.)</span></p><p>By default, Tapestry secures file extensions ".class',
".tml" and ".properties". The list can be extended by contributing to the <a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/ResourceDigestGenerator.html">ResourceDigestGenerator</a>
service:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>AppModule.java (partial)</b></div><div class="codeContent panelContent
pdl">
+</div></div><div class="confluence-information-macro
confluence-information-macro-note"><span class="aui-icon aui-icon-small
aui-iconfont-warning confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>The use of the <code>${...</code>}
syntax here is a <em>symbol expansion</em> (because it occurs in an annotation
in Java code), rather than a <em>template expansion</em> (which occurs only in
Tapestry template files).</p></div></div><p>An override of the skin.root symbol
would affect all references to the named asset.</p><h3
id="Assets-LocalizationofAssets">Localization of Assets</h3><p>Main Article: <a
href="assets.html">Assets</a></p><p>Assets are localized; Tapestry will search
for a variation of the file appropriate to the effective locale for the
request. In the previous example, a German user of the application may see a
file named <code>edit_de.png</code> (if such a file exists).</p><h3
id="Assets-NewAssetDomains">New Asset Domains</h3><p>I
f you wish to create new domains for assets, for example to allow assets to be
stored on the file system or in a database, you may define a new <a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/AssetFactory.html">AssetFactory</a>
and contribute it to the <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/AssetSource.html">AssetSource</a>
service configuration.</p><h3
id="Assets-AssetFingerprinting(Tapestry5.3andearlier)">Asset Fingerprinting
(Tapestry 5.3 and earlier)</h3><p>Tapestry creates a new URL for assets
(whether context or classpath). The URL is of the form
/assets/<strong>version</strong>/<strong>folder</strong>/<strong>path</strong>.</p><ul><li><strong>version</strong>:
Application version number, defined by the
<code>tapestry.application-version</code> symbol in your application module
(normally AppModule.java). The default is a random hex number.</li><li><strong>
folder</strong>: Identifies the library containing the asset, or "ctx" for a
context asset, or "stack" (used when combining multiple JavaScript files into a
single virtual asset).</li><li><strong>path</strong>: The path below the root
package of the library to the specific asset file.</li></ul><h3
id="Assets-AssetFingerprinting(Tapestry5.4andlater)">Asset
Fingerprinting<span> (Tapestry 5.4 and later)</span></h3><p>Tapestry 5.4
changes how Asset URLs are constructed. The version number is now
a <em>content fingerprint</em>, a hash of the actual content of the
asset.</p><p>Assets get a far-future expires header. It is no longer necessary
or desirable to change the application version number.</p><p>During development
or production, if an asset is changed in any way, it will have a new content
fingerprint and will appear, to the browser, to be an entirely new immutable
resource.</p><h3 id="Assets-CSSLinkRewriting">CSS Link Rewriting</h3><p>It is
frequently the case that CSS fi
les will include links to other files, such as background images, using
the <code>url</code>() value syntax. Under 5.4, the URL for the CSS file
and the targeted file would be broken, due to the inclusions of the CSS file's
content hash fingerprint. To fix this, Tapestry parses CSS files, locates
the <code>url()</code> directives, and rewrites the URLs to be absolute
(including the targeted file's content hash fingerprint).</p><h3
id="Assets-PerformanceNotes">Performance Notes</h3><p>Assets are expected to be
entirely static (not changing while the application is deployed). This allows
Tapestry to perform some important performance optimizations.</p><p>Tapestry
GZIP compresses the content of all assets – if the asset is compressible,
the client supports it, and you don't <a href="assets.html">explicitly disable
it</a>.</p><p><span>Further, the asset will get a </span><em>far future expires
header</em><span>, which will encourage the client browser to cache the asset
.</span></p><p>You should have an explicit application version number for any
production application. Client browsers will aggressively cache downloaded
assets; they will usually not even send a request to see if the asset has
changed once the asset is downloaded the first time. Because of this it is
<em>very important</em> that each new deployment of your application has a new
<a href="assets.html">version number</a>, to force existing clients to
re-download all assets.</p><h3 id="Assets-AssetSecurity">Asset
Security</h3><div class="confluence-information-macro
confluence-information-macro-warning"><span class="aui-icon aui-icon-small
aui-iconfont-error confluence-information-macro-icon"></span><div
class="confluence-information-macro-body"><p>This applies to how Tapestry 5.3
and earlier manage classpath assets; Tapestry 5.4 introduces another system
which doesn't have this issue.</p></div></div><p>Because Tapestry directly
exposes files on the classpath to the clients, some thoug
ht has gone into ensuring that malicious clients are not able to download
assets that should not be visible to them.</p><p>First off all, there's a
package limitation: classpath assets are only visible if there's a <a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/LibraryMapping.html">LibraryMapping</a>
for them, and the library mapping substitutes for the initial folders on the
classpath. Since the most secure assets, things like
<code>hibernate.cfg.xml</code> are located in the unnamed package, they are
always off limits.</p><p>But what about other files on the classpath? Imagine
this scenario:</p><ul><li>Your Login page exposes a classpath asset,
<code>icon.png</code>.</li><li><p>A malicious client copies the URL,
<code>/assets/1.0.0/app/pages/icon.png (</code><span>which would indicate that
the Login page is actually inside a library, which is unlikely. More likely,
icon.png is a context asset and the malicious user guessed
the path for Login.class by looking at the Tapestry source
code.) </span><span>and changes the file name to
</span><code>Login.class</code><span>.</span></p></li><li><p>The client
decompiles the class file and spots your secret emergency password: goodbye
security! (<span>Never create such back doors, of
course!)</span></p></li></ul><p>Fortunately, this can't happen. Files with
extension ".class" are secured; they must be accompanied in the URL with a
query parameter that is the MD5 hash of the file's contents. If the query
parameter is absent, or doesn't match the actual file's content, the request is
rejected.</p><p>When your code exposes an Asset that is secured, Tapestry
generates a URL that automatically includes MD5 hash query parameter. The
malicious user is locked out of access to the files. (The only way they could
generate the MD5 hash is if<span> they somehow already have the files, in which
case they don't need to download them again anyway.)</span></p><p>By default
, Tapestry secures file extensions ".class', ".tml" and ".properties". The
list can be extended by contributing to the <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/ResourceDigestGenerator.html">ResourceDigestGenerator</a>
service:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>AppModule.java (partial)</b></div><div class="codeContent panelContent
pdl">
<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">public static void
contributeResourceDigestGenerator(Configuration<String> configuration)
{
configuration.add("xyz");
@@ -138,7 +184,7 @@ private Asset style;
<version>5.4</version>
</dependency>
</pre>
-</div></div></div></div></div></div><p> </p><p>By adding this dependency,
all your JavaScript and CSS files will be minimized when <a
href="configuration.html">PRODUCTION_MODE=true</a>. You can force the
minimization of these files, by changing the value of the constant
SymbolConstants.MINIFICATION_ENABLED in your module class (usually
AppModule.java):</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>AppModule.java (partial)</b></div><div class="codeContent panelContent
pdl">
+</div></div></div></div></div></div><p> </p><p>By adding this dependency,
all your JavaScript and CSS files will be minimized when <a
href="assets.html">PRODUCTION_MODE=true</a>. You can force the minimization of
these files, by changing the value of the constant
SymbolConstants.MINIFICATION_ENABLED in your module class (usually
AppModule.java):</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeHeader panelHeader pdl" style="border-bottom-width:
1px;"><b>AppModule.java (partial)</b></div><div class="codeContent panelContent
pdl">
<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Contribute(SymbolProvider.class)
@ApplicationDefaults
public static void
contributeApplicationDefaults(MappedConfiguration<String, String>
configuration)
Modified: websites/production/tapestry/content/beaneditform-guide.html
==============================================================================
--- websites/production/tapestry/content/beaneditform-guide.html (original)
+++ websites/production/tapestry/content/beaneditform-guide.html Sat Feb 3
16:21:22 2018
@@ -27,6 +27,16 @@
</title>
<link type="text/css" rel="stylesheet" href="/resources/space.css" />
+ <link href='/resources/highlighter/styles/shCoreCXF.css'
rel='stylesheet' type='text/css' />
+ <link href='/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet'
type='text/css' />
+ <script src='/resources/highlighter/scripts/shCore.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushJava.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushXml.js'
type='text/javascript'></script>
+ <script src='/resources/highlighter/scripts/shBrushPlain.js'
type='text/javascript'></script>
+ <script>
+ SyntaxHighlighter.defaults['toolbar'] = false;
+ SyntaxHighlighter.all();
+ </script>
<link href="/styles/style.css" rel="stylesheet" type="text/css"/>
@@ -67,18 +77,20 @@
</div>
<div id="content">
- <div id="ConfluenceContent"><p><strong>BeanEditForm</strong>
is a powerful Tapestry component capable of generating a complete create/edit
user interface for a typical
JavaBean.</p><plain-text-body>{float:right|background=#eee|padding=0 1em}
- *JumpStart Demos:*
- [Edit (Using
BeanEditForm)|http://jumpstart.doublenegative.com.au/jumpstart/examples/input/edit1/1]
- [Create (Using
BeanEditForm)|http://jumpstart.doublenegative.com.au/jumpstart/examples/input/create1]
- [More Control Edit (Using
BeanEditor)|http://jumpstart.doublenegative.com.au/jumpstart/examples/input/morecontroledit1/1]
-{float}</plain-text-body><p>BeanEditForm analyzes the the properties of the
bean, locating just those properties that are readable and writeable. It
filters down to properties whose type is mapped to a known editor (this is
described in more detail below).</p><p>The default ordering for properties is
in the order in which the <em>getter methods</em> for the properties are
defined. When a super-class defines editable properties, those are ordered
before sub-class properties.</p><h2
id="BeanEditFormGuide-SupportedTypes">Supported Types</h2><p>The default set of
property types supported by BeanEditForm:</p><ul><li>String: as a text
field</li><li>Number: as a text field</li><li>Enum: as a drop-down
list</li><li>Boolean: as a checkbox</li><li>Date: as a JavaScript
calendar</li><li>Calendar: as a JavaScript calendar</li></ul><p>Resolving a
property type to an editor type involves a search up the inheritance hierarchy:
thus the super-type of Integer, Long, BigDecimal, etc. is Number, which
uses a text field for data entry.</p><p>The list of supported property types
is extensible (this is documented below).</p><h2
id="BeanEditFormGuide-AutomaticObjectCreation">Automatic Object
Creation</h2><p>When a page is rendered, the BeanEditForm component will read
its object parameter as the JavaBean to edit (with the current properties of
the JavaBean becoming the defaults for the various fields). Likewise, when the
form is submitted by the user, the object parameter is read and its properties
populated from the request.</p><p>If the object does not exist, it will be
created as needed. The type is determined from the property type, which should
be a specific type in order for automatic creation to operate
properly.</p><p>The BeanEditForm component will attempt to instantiate a value
for the property as necessary, when the form is submitted. This can be a
problem when the property type is an interface, rather than an instantiable
class.</p><p>One option is to provide an event ha
ndler for the "prepare" or "prepareForSubmit" events to instantiate an
instance to receive the submitted information.</p><p>For a class, Tapestry will
select the public constructor with the <em>most</em> parameters. If this is not
desirable (for example, if you get an exception), then place the @<a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/annotations/Inject.html">Inject</a>
annotation on the constructor Tapestry should use.</p><h2
id="BeanEditFormGuide-ImplicitObjectBinding">Implicit Object Binding</h2><p>If
the object parameter is not bound, then an implicit binding to a property of
the containing component is made. The bound property will be the BeanEditForm
component's id, if such a property exists. Thus you may typically give the
BeanEditForm component an id (that matches a property) and not have to bind the
object parameter.</p><h2 id="BeanEditFormGuide-Non-VisualProperties">Non-Visual
Properties</h2><p>In some cases, a pr
operty may be updatable and of a supported type for editing, but should not be
presented to the user for editing: for example, a property that holds the
primary key of a database entity. In such a case, the @<a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/beaneditor/NonVisual.html">NonVisual</a>
annotation may be applied to the property (either the getter or the setter
method).</p><h2 id="BeanEditFormGuide-DefaultValidation">Default
Validation</h2><p>Default validation for fields is primary determined by
property type.</p><p>If desired, additional validation may be specified using
the @<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/beaneditor/Validate.html">Validate</a>
annotation. See <a href="forms-and-validation.html">Forms and
Validation</a>.</p><p>As of Tapestry 5.2, validation may also be specified via
the containing component's property file, using a key in the form of <code>prop
ertyId-validate</code> (eg: myfield-validate=required).</p><h2
id="BeanEditFormGuide-Propertyordering">Property ordering</h2><p>By default,
the order in which properties are presented is as defined above (order of the
getter method). This can be overridden using the <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/beaneditor/ReorderProperties.html">ReorderProperties</a>
class annotation.</p><h2 id="BeanEditFormGuide-DefaultLabel">Default
Label</h2><p>Tapestry will attempt to provide a reasonable default label for
each field, based on the property name being emitted. The property name is
capitalized, and spaces are added before case changes, thus property "name"
becomes label "Name" and property "streetAddress" becomes label "Street
Address".</p><p>BeanEditForm also searches for a label for the field in the
containing component's message catalog. The message key is the property name
suffixed with "-label". If such a label is found, it ta
kes precedence.</p><h1 id="BeanEditFormGuide-PropertyEditorOverrides">Property
Editor Overrides</h1><p>You may override the editor for any particular
property, using the a block parameter to the BeanEditForm component.</p><p>An
editor normally consists of a Label component and some form of field component
(such as TextField or TextArea).</p><p>For example, you may want to selectively
use a PasswordField component:</p><parameter
ac:name="">java</parameter><plain-text-body> <t:beaneditform
object="loginCredentials">
+ <div id="ConfluenceContent"><p><strong>BeanEditForm</strong>
is a powerful Tapestry component capable of generating a complete create/edit
user interface for a typical JavaBean.</p><div class="navmenu"
style="float:right; background:#eee; margin:3px; padding:0 1em">
+<p> <strong>JumpStart Demos:</strong><br clear="none">
+ <a class="external-link"
href="http://jumpstart.doublenegative.com.au/jumpstart/examples/input/edit1/1"
rel="nofollow">Edit (Using BeanEditForm)</a><br clear="none">
+ <a class="external-link"
href="http://jumpstart.doublenegative.com.au/jumpstart/examples/input/create1"
rel="nofollow">Create (Using BeanEditForm)</a><br clear="none">
+ <a class="external-link"
href="http://jumpstart.doublenegative.com.au/jumpstart/examples/input/morecontroledit1/1"
rel="nofollow">More Control Edit (Using BeanEditor)</a></p></div>BeanEditForm
analyzes the the properties of the bean, locating just those properties that
are readable and writeable. It filters down to properties whose type is mapped
to a known editor (this is described in more detail below).<p>The default
ordering for properties is in the order in which the <em>getter methods</em>
for the properties are defined. When a super-class defines editable properties,
those are ordered before sub-class properties.</p><h2
id="BeanEditFormGuide-SupportedTypes">Supported Types</h2><p>The default set of
property types supported by BeanEditForm:</p><ul><li>String: as a text
field</li><li>Number: as a text field</li><li>Enum: as a drop-down
list</li><li>Boolean: as a checkbox</li><li>Date: as a JavaScript
calendar</li><li>Calendar: as a JavaScript calendar</li></ul><p>Resolving
a property type to an editor type involves a search up the inheritance
hierarchy: thus the super-type of Integer, Long, BigDecimal, etc. is Number,
which uses a text field for data entry.</p><p>The list of supported property
types is extensible (this is documented below).</p><h2
id="BeanEditFormGuide-AutomaticObjectCreation">Automatic Object
Creation</h2><p>When a page is rendered, the BeanEditForm component will read
its object parameter as the JavaBean to edit (with the current properties of
the JavaBean becoming the defaults for the various fields). Likewise, when the
form is submitted by the user, the object parameter is read and its properties
populated from the request.</p><p>If the object does not exist, it will be
created as needed. The type is determined from the property type, which should
be a specific type in order for automatic creation to operate
properly.</p><p>The BeanEditForm component will attempt to instantiate a value
for the property as necessary, when the form
is submitted. This can be a problem when the property type is an interface,
rather than an instantiable class.</p><p>One option is to provide an event
handler for the "prepare" or "prepareForSubmit" events to instantiate an
instance to receive the submitted information.</p><p>For a class, Tapestry will
select the public constructor with the <em>most</em> parameters. If this is not
desirable (for example, if you get an exception), then place the @<a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/annotations/Inject.html">Inject</a>
annotation on the constructor Tapestry should use.</p><h2
id="BeanEditFormGuide-ImplicitObjectBinding">Implicit Object Binding</h2><p>If
the object parameter is not bound, then an implicit binding to a property of
the containing component is made. The bound property will be the BeanEditForm
component's id, if such a property exists. Thus you may typically give the
BeanEditForm component an id (that matches a
property) and not have to bind the object parameter.</p><h2
id="BeanEditFormGuide-Non-VisualProperties">Non-Visual Properties</h2><p>In
some cases, a property may be updatable and of a supported type for editing,
but should not be presented to the user for editing: for example, a property
that holds the primary key of a database entity. In such a case, the @<a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/beaneditor/NonVisual.html">NonVisual</a>
annotation may be applied to the property (either the getter or the setter
method).</p><h2 id="BeanEditFormGuide-DefaultValidation">Default
Validation</h2><p>Default validation for fields is primary determined by
property type.</p><p>If desired, additional validation may be specified using
the @<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/beaneditor/Validate.html">Validate</a>
annotation. See <a href="beaneditform-guide.html">BeanEditForm Guid
e</a>.</p><p>As of Tapestry 5.2, validation may also be specified via the
containing component's property file, using a key in the form of
<code>propertyId-validate</code> (eg: myfield-validate=required).</p><h2
id="BeanEditFormGuide-Propertyordering">Property ordering</h2><p>By default,
the order in which properties are presented is as defined above (order of the
getter method). This can be overridden using the <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/beaneditor/ReorderProperties.html">ReorderProperties</a>
class annotation.</p><h2 id="BeanEditFormGuide-DefaultLabel">Default
Label</h2><p>Tapestry will attempt to provide a reasonable default label for
each field, based on the property name being emitted. The property name is
capitalized, and spaces are added before case changes, thus property "name"
becomes label "Name" and property "streetAddress" becomes label "Street
Address".</p><p>BeanEditForm also searches for a label for
the field in the containing component's message catalog. The message key is
the property name suffixed with "-label". If such a label is found, it takes
precedence.</p><h1 id="BeanEditFormGuide-PropertyEditorOverrides">Property
Editor Overrides</h1><p>You may override the editor for any particular
property, using the a block parameter to the BeanEditForm component.</p><p>An
editor normally consists of a Label component and some form of field component
(such as TextField or TextArea).</p><p>For example, you may want to selectively
use a PasswordField component:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"> <t:beaneditform object="loginCredentials">
<p:password>
<t:label for="password"/>
<t:passwordfield t:id="password"
value="loginCredentials.password"/>
</p:password>
</t:beaneditform>
-</plain-text-body><p>The other fields will render normally (using the built-in
editors).</p><h1 id="BeanEditFormGuide-CustomizingtheBeanModel">Customizing the
BeanModel</h1><p>You may want to customize the BeanModel further, to remove
from the form properties that should not be editable by the user, and to change
the order in which properties are presented within the form.</p><p>The
BeanEditForm component has several parameters for this purpose:</p><ul><li>add:
A comma separated list of property names to add to the model.</li><li>include:
A comma separated list of property names to keep with the model (others are
excluded).</li><li>exclude: A comma separated list of property names to exclude
from the model.</li><li>reorder: A comma separated list of property names
indicating the desired order.<br clear="none"> If a model has more properties
that are listed in the reorder parameter, then the additional properties will
be ordered at the end of the form.</li></ul><p>Note that these par
ameters <em>modify</em> the BeanModel. If you supply your own BeanModel (via
the model parameter) you should not use the add, include, exclude or reorder
parameters.</p><p>Added properties must not conflict with normal properties.
Cells for added properties will render blank unless an override is
provided.</p><h1 id="BeanEditFormGuide-ProvidingtheBeanModel">Providing the
BeanModel</h1><p>The BeanEditForm component operates in terms of a <a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/beaneditor/BeanModel.html">BeanModel</a>,
which describes the properties, their presentation order, labels and so
forth.</p><p>Normally, the BeanEditForm automatically creates the BeanModel as
needed, based on the type of object bound to its object
parameter.</p><p>Alternately, the BeanModel can be supplied as the model
parameter. This can be useful in situations where the exclude and reorder
parameters are insufficient. For example, if the the type of the
property being edited is an interface type, it may be useful to provide an
explicit BeanModel around an underlying implementation class.</p><p>The model
can be created when the page is first instantiated:</p><parameter
ac:name="">java</parameter><plain-text-body>public class MyPage
+</pre>
+</div></div><p>The other fields will render normally (using the built-in
editors).</p><h1 id="BeanEditFormGuide-CustomizingtheBeanModel">Customizing the
BeanModel</h1><p>You may want to customize the BeanModel further, to remove
from the form properties that should not be editable by the user, and to change
the order in which properties are presented within the form.</p><p>The
BeanEditForm component has several parameters for this purpose:</p><ul><li>add:
A comma separated list of property names to add to the model.</li><li>include:
A comma separated list of property names to keep with the model (others are
excluded).</li><li>exclude: A comma separated list of property names to exclude
from the model.</li><li>reorder: A comma separated list of property names
indicating the desired order.<br clear="none"> If a model has more properties
that are listed in the reorder parameter, then the additional properties will
be ordered at the end of the form.</li></ul><p>Note that these parameter
s <em>modify</em> the BeanModel. If you supply your own BeanModel (via the
model parameter) you should not use the add, include, exclude or reorder
parameters.</p><p>Added properties must not conflict with normal properties.
Cells for added properties will render blank unless an override is
provided.</p><h1 id="BeanEditFormGuide-ProvidingtheBeanModel">Providing the
BeanModel</h1><p>The BeanEditForm component operates in terms of a <a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/beaneditor/BeanModel.html">BeanModel</a>,
which describes the properties, their presentation order, labels and so
forth.</p><p>Normally, the BeanEditForm automatically creates the BeanModel as
needed, based on the type of object bound to its object
parameter.</p><p>Alternately, the BeanModel can be supplied as the model
parameter. This can be useful in situations where the exclude and reorder
parameters are insufficient. For example, if the the type of the prope
rty being edited is an interface type, it may be useful to provide an explicit
BeanModel around an underlying implementation class.</p><p>The model can be
created when the page is first instantiated:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">public class MyPage
{
@Inject
private BeanModelSource beanModelSource;
@@ -100,12 +112,18 @@
}
}
-</plain-text-body><p>And, in the component template, the built model can be
passed to the BeanEditForm component explicitly:</p><parameter
ac:name="">java</parameter><plain-text-body> <t:beaneditform object="bean"
model="model"/>
-</plain-text-body><h1 id="BeanEditFormGuide-AddingNewPropertyEditors">Adding
New Property Editors</h1><p>Adding a new property editor is a three step
process.</p><p>First, decide on a logical name for the data type. For example,
you may decide that the BigDecimal type will represent currency in your
application, so name the data type "currency".</p><p>Next, you must make
contributions to the <a class="external-link"
href="http://tapestry.apache.org/current/apidocsapidocs/org/apache/tapestry5/services/DataTypeAnalyzer.html">DataTypeAnalyzer</a>
or <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/internal/services/DefaultDataTypeAnalyzer.html">DefaultDataTypeAnalyzer</a>
services to match properties to your new name.</p><p>DataTypeAnalyzer is a
chain of command that can match properties to data types based on property type
or annotations on the property. In general, DefaultDataTypeAnalyzer is used, as
that only needs to consider property
type. DefaultDataTypeAnalyzer matches property types to data types, based on
a search up the inheritance path.</p><parameter
ac:name="">java</parameter><plain-text-body>public static void
contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String>
configuration)
+</pre>
+</div></div><p>And, in the component template, the built model can be passed
to the BeanEditForm component explicitly:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"> <t:beaneditform object="bean" model="model"/>
+</pre>
+</div></div><h1 id="BeanEditFormGuide-AddingNewPropertyEditors">Adding New
Property Editors</h1><p>Adding a new property editor is a three step
process.</p><p>First, decide on a logical name for the data type. For example,
you may decide that the BigDecimal type will represent currency in your
application, so name the data type "currency".</p><p>Next, you must make
contributions to the <a class="external-link"
href="http://tapestry.apache.org/current/apidocsapidocs/org/apache/tapestry5/services/DataTypeAnalyzer.html">DataTypeAnalyzer</a>
or <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/internal/services/DefaultDataTypeAnalyzer.html">DefaultDataTypeAnalyzer</a>
services to match properties to your new name.</p><p>DataTypeAnalyzer is a
chain of command that can match properties to data types based on property type
or annotations on the property. In general, DefaultDataTypeAnalyzer is used, as
that only needs to consider property type.
DefaultDataTypeAnalyzer matches property types to data types, based on a
search up the inheritance path.</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">public static void
contributeDefaultDataTypeAnalyzer(MappedConfiguration<Class, String>
configuration)
{
configuration.add(BigDecimal.class, "currency");
}
-</plain-text-body><p>You must provide an editor for the "currency" data type.
An editor is a block of a page of the application; this page is not normally
rendered itself, but acts as a container for one or more blocks.</p><parameter
ac:name="">java</parameter><plain-text-body>public class AppPropertyEditBlocks
+</pre>
+</div></div><p>You must provide an editor for the "currency" data type. An
editor is a block of a page of the application; this page is not normally
rendered itself, but acts as a container for one or more blocks.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">public class AppPropertyEditBlocks
{
@Property
@Environmental
@@ -130,15 +148,20 @@
return context.getTranslator(current);
}
}
-</plain-text-body><p>The hard part is the translator; this is a piece of code
that understands how to format and how to parse a currency value. It must be
wrapped to create a FieldTranslator.</p><p>The editor is a block inside the
component template:</p><parameter ac:name="">java</parameter><plain-text-body>
<t:block id="currency">
+</pre>
+</div></div><p>The hard part is the translator; this is a piece of code that
understands how to format and how to parse a currency value. It must be wrapped
to create a FieldTranslator.</p><p>The editor is a block inside the component
template:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;"> <t:block id="currency">
<t:label for="currency"/>
<t:textfield t:id="currency" size="10"/>
</t:block>
-</plain-text-body><p>Finally, we tell the BeanEditForm component about the
editor via a contribution to the <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/BeanBlockSource.html">BeanBlockSource</a>
service:</p><parameter ac:name="">java</parameter><plain-text-body>public
static void
contributeBeanBlockSource(Configuration<BeanBlockContribution>
configuration)
+</pre>
+</div></div><p>Finally, we tell the BeanEditForm component about the editor
via a contribution to the <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/BeanBlockSource.html">BeanBlockSource</a>
service:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">public static void
contributeBeanBlockSource(Configuration<BeanBlockContribution>
configuration)
{
configuration.add(new BeanBlockContribution("currency",
"AppPropertyEditBlocks", "currency", true));
}
-</plain-text-body><p>Now, when the BeanEditForm sees a property of type
BigDecimal, it will map that to datatype "currency" and from there to the
currency block of the AppPropertyEditBlocks page of the application.</p></div>
+</pre>
+</div></div><p>Now, when the BeanEditForm sees a property of type BigDecimal,
it will map that to datatype "currency" and from there to the currency block of
the AppPropertyEditBlocks page of the application.</p></div>
</div>
<div class="clearer"></div>
Modified: websites/production/tapestry/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/tapestry/content/class-reloading.html
==============================================================================
--- websites/production/tapestry/content/class-reloading.html (original)
+++ websites/production/tapestry/content/class-reloading.html Sat Feb 3
16:21:22 2018
@@ -110,13 +110,7 @@
</div>
-<p>One of the best features of Tapestry is automatic reloading of changed
classes and templates. <em>Page and component</em> classes will automatically
reload when changed. Likewise, changes to component templates and other related
resources will also be picked up immediately. In addition, starting in version
5.2, your service classes will also be reloaded automatically after changes (if
you're using <a href="class-reloading.html">Tapestry IoC</a>).</p><h2
id="ClassReloading-TemplateReloading">Template Reloading</h2><p>When a template
changes, all page instances (as well as the hierarchy of components below them)
are discarded and reconstructed with the new template. However, classes are not
reloaded in this case.</p><h2 id="ClassReloading-ClassReloading">Class
Reloading</h2><p>On a change to <em>any</em> loaded class from inside a
controlled package (or any sub-package of a controlled package), Tapestry will
discard all page instances, and discard the class loader.</p><p><a href=
"class-reloading.html">Persistent field data</a> on the pages will usually not
be affected (as it is stored separately, usually in the session). This allows
you to make fairly significant changes to a component class even while the
application continues to run.</p><h2
id="ClassReloading-PackagesScanned">Packages Scanned</h2><p>Only certain
classes are subject to reload. Reloading is based on package name; the packages
that are reloaded are derived from the <a
href="class-reloading.html">application configuration</a>.</p><p>If your root
package is <code>org.example.myapp</code>, then only classes in the following
packages (and their sub-packages) will be scanned for automatic
reloads:</p><ul><li>org.example.myapp.pages</li><li>org.example.myapp.components</li><li>org.example.myapp.mixins</li><li>org.example.myapp.base</li><li>org.example.myapp.services
(Tapestry 5.2 and later, with restrictions)</li></ul><p>
-
-</p><div class="confluence-information-macro
confluence-information-macro-information"><p class="title">Added in
5.2</p><span class="aui-icon aui-icon-small aui-iconfont-info
confluence-information-macro-icon"></span><div
class="confluence-information-macro-body">
-</div></div>
-<div class="error"><span class="error">Unknown macro: {div}</span>
-<p>Starting in Tapestry 5.2, live class reloading includes service
implementation classes. There are some limitations to this. See <a
href="service-implementation-reloading.html" title="Service Implementation
Reloading">Service Implementation Reloading</a> for more details.</p>
-</div><h2 id="ClassReloading-FileSystemOnly">File System Only</h2><p>Reloading
of classes and other files applies only to files that are actually on the file
system, and not files obtained from JAR files. This is perfect during
development, where the files in question are in your local workspace. In a
deployed application, you are somewhat subject to the implementation of your
servlet container or application server.</p><h2
id="ClassReloading-ClassLoaderIssues">Class Loader Issues</h2><p>Tapestry uses
an extra class loader to load page and component classes.</p><p>When a change
to an underlying Java class file is detected, Tapestry discards the class
loader and any pooled page instances.</p><p>You should be careful to not hold
any references to Tapestry pages or components in other code, such as Tapestry
IoC services. Holding such references can cause significant memory leaks, as
they can prevent the class loader from being reclaimed by the garbage
collector.</p><h2 id="ClassReloadi
ng-ClassCastExceptions">ClassCastExceptions</h2><p>Tapestry's class loader
architecture can cause minor headaches when you make use of a services layer,
or any time that you pass component instances to objects that are not
themselves components.</p><p>In such cases you may see ClassCastException
errors. This is because the same class name, say org.example.myapp.pages.Start,
exists as two different class instances. One class instance is loaded by the
web application's default class loader. A second class instance has been loaded
<em>and transformed</em> by Tapestry's reloading class loader.</p><p>Ordinary
classes, such as Tapestry IoC Services, will be loaded by the default class
loader and expect instances to be loaded by the same class loader (or a
parent).</p><p>The solution to this problem is to introduce an interface; the
component class should implement the interface, and the service should expect
an instance of the interface, rather than a specific type.</p><p>It is
important
that the interface be loaded by the default class loader. It should not be in
the pages or components package, but instead be in another package, such as
services.</p><h2 id="ClassReloading-HandlingReloadsinyourCode">Handling Reloads
in your Code</h2><p>On occasion, you may need to know when invalidations occur,
to clear your own cache. For example, if you have a binding that creates new
classes, the way <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/PropertyConduitSource.html">PropertyConduitSource</a>
does, you need to discard any cached classes or instances when a change is
detected in component classes.</p><p>You do this by registering a listener with
the correct <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tpaestry5/services/InvalidationEventHub.html">InvalidationEventHub</a>
service.</p><p>For example, your service may be in the business of creating
new classes based on component
classes, and keep a cache of those classes:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<p>One of the best features of Tapestry is automatic reloading of changed
classes and templates. <em>Page and component</em> classes will automatically
reload when changed. Likewise, changes to component templates and other related
resources will also be picked up immediately. In addition, starting in version
5.2, your service classes will also be reloaded automatically after changes (if
you're using <a href="class-reloading.html">Tapestry IoC</a>).</p><h2
id="ClassReloading-TemplateReloading">Template Reloading</h2><p>When a template
changes, all page instances (as well as the hierarchy of components below them)
are discarded and reconstructed with the new template. However, classes are not
reloaded in this case.</p><h2 id="ClassReloading-ClassReloading">Class
Reloading</h2><p>On a change to <em>any</em> loaded class from inside a
controlled package (or any sub-package of a controlled package), Tapestry will
discard all page instances, and discard the class loader.</p><p><a href=
"class-reloading.html">Persistent field data</a> on the pages will usually not
be affected (as it is stored separately, usually in the session). This allows
you to make fairly significant changes to a component class even while the
application continues to run.</p><h2
id="ClassReloading-PackagesScanned">Packages Scanned</h2><p>Only certain
classes are subject to reload. Reloading is based on package name; the packages
that are reloaded are derived from the <a
href="class-reloading.html">application configuration</a>.</p><p>If your root
package is <code>org.example.myapp</code>, then only classes in the following
packages (and their sub-packages) will be scanned for automatic
reloads:</p><ul><li>org.example.myapp.pages</li><li>org.example.myapp.components</li><li>org.example.myapp.mixins</li><li>org.example.myapp.base</li><li>org.example.myapp.services
(Tapestry 5.2 and later, with restrictions)</li></ul><p>Starting in Tapestry
5.2, live class reloading includes service implementati
on classes. There are some limitations to this. See <a
href="service-implementation-reloading.html">Service Implementation
Reloading</a> for more details.</p><h2 id="ClassReloading-FileSystemOnly">File
System Only</h2><p>Reloading of classes and other files applies only to files
that are actually on the file system, and not files obtained from JAR files.
This is perfect during development, where the files in question are in your
local workspace. In a deployed application, you are somewhat subject to the
implementation of your servlet container or application server.</p><h2
id="ClassReloading-ClassLoaderIssues">Class Loader Issues</h2><p>Tapestry uses
an extra class loader to load page and component classes.</p><p>When a change
to an underlying Java class file is detected, Tapestry discards the class
loader and any pooled page instances.</p><p>You should be careful to not hold
any references to Tapestry pages or components in other code, such as Tapestry
IoC services. Holding s
uch references can cause significant memory leaks, as they can prevent the
class loader from being reclaimed by the garbage collector.</p><h2
id="ClassReloading-ClassCastExceptions">ClassCastExceptions</h2><p>Tapestry's
class loader architecture can cause minor headaches when you make use of a
services layer, or any time that you pass component instances to objects that
are not themselves components.</p><p>In such cases you may see
ClassCastException errors. This is because the same class name, say
org.example.myapp.pages.Start, exists as two different class instances. One
class instance is loaded by the web application's default class loader. A
second class instance has been loaded <em>and transformed</em> by Tapestry's
reloading class loader.</p><p>Ordinary classes, such as Tapestry IoC Services,
will be loaded by the default class loader and expect instances to be loaded by
the same class loader (or a parent).</p><p>The solution to this problem is to
introduce an interface; the c
omponent class should implement the interface, and the service should expect
an instance of the interface, rather than a specific type.</p><p>It is
important that the interface be loaded by the default class loader. It should
not be in the pages or components package, but instead be in another package,
such as services.</p><h2 id="ClassReloading-HandlingReloadsinyourCode">Handling
Reloads in your Code</h2><p>On occasion, you may need to know when
invalidations occur, to clear your own cache. For example, if you have a
binding that creates new classes, the way <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/PropertyConduitSource.html">PropertyConduitSource</a>
does, you need to discard any cached classes or instances when a change is
detected in component classes.</p><p>You do this by registering a listener with
the correct <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tpaestry5/services/
InvalidationEventHub.html">InvalidationEventHub</a> service.</p><p>For
example, your service may be in the business of creating new classes based on
component classes, and keep a cache of those classes:</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">public class MyServiceImpl implements MyService,
InvalidationEventListener
{
public final Map<String,Class> cache = new
ConcurrentHashMap<String,Class>();