Modified: websites/production/tapestry/content/annotations.html
==============================================================================
--- websites/production/tapestry/content/annotations.html (original)
+++ websites/production/tapestry/content/annotations.html Wed Sep 20 12:29:16
2017
@@ -36,26 +36,13 @@
<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>
@@ -67,7 +54,19 @@
</div>
<div id="content">
- <div id="ConfluenceContent"><parameter
ac:name="style">float:right</parameter><parameter ac:name="title">Related
Articles</parameter><parameter
ac:name="class">aui-label</parameter><rich-text-body><parameter
ac:name="showLabels">false</parameter><parameter
ac:name="showSpace">false</parameter><parameter ac:name="title">Related
Articles</parameter><parameter ac:name="cql">label = "annotations" and space =
currentSpace()</parameter></rich-text-body><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-i
oc 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 i
ntended 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 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 – Release
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 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>
<div class="clearer"></div>
Modified:
websites/production/tapestry/content/application-module-class-cheat-sheet.html
==============================================================================
---
websites/production/tapestry/content/application-module-class-cheat-sheet.html
(original)
+++
websites/production/tapestry/content/application-module-class-cheat-sheet.html
Wed Sep 20 12:29:16 2017
@@ -27,6 +27,14 @@
</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>
+ SyntaxHighlighter.defaults['toolbar'] = false;
+ SyntaxHighlighter.all();
+ </script>
<link href="/styles/style.css" rel="stylesheet" type="text/css"/>
@@ -36,26 +44,13 @@
<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">Application Module Class Cheat Sheet</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">Application Module Class Cheat Sheet</h1></div></div>
<div class="clearer"></div>
</div>
@@ -67,7 +62,60 @@
</div>
<div id="content">
- <div id="ConfluenceContent"><p><parameter
ac:name="hidden">true</parameter><parameter
ac:name="atlassian-macro-output-type">INLINE</parameter><rich-text-body><p>a
guide to what goes in your application module (usually
AppModule.java)</p></rich-text-body> </p><p>The <strong>Application
Module</strong> class is a simple Java class used to configure Tapestry. A
system of annotations and naming conventions allows Tapestry to determine what
services are provided by the module to your application. This is the place
where you bind your custom implementation of services, contribute to, decorate
and override existing services.</p><p></p><parameter
ac:name="style">float:right</parameter><parameter ac:name="title">Related
Articles</parameter><parameter
ac:name="class">aui-label</parameter><rich-text-body><parameter
ac:name="showLabels">false</parameter><parameter
ac:name="showSpace">false</parameter><parameter ac:name="title">Related
Articles</parameter><parameter ac:name=
"cql">label = "configuration" and space =
currentSpace()</parameter></rich-text-body><p>For complete documentation, you
should refer to the <a href="defining-tapestry-ioc-services.html">IOC Service
guideline</a>.</p><h2
id="ApplicationModuleClassCheatSheet-Namingconventions">Naming
conventions</h2><p>The use of naming conventions implies that every public
method of your module class should be meaningful to Tapestry: it either should
follow the naming conventions, or should have an appropriate annotation. Any
extra public methods will result in startup exceptions ... this helps identify
methods names that have typos.</p><p>Methods should be <strong>public</strong>
and, preferably <strong>static</strong>.</p><rich-text-body><p>Allowing for
non-static methods may have been a design error, a kind of premature
optimization. The thinking was that the module could have common dependencies
that it could then easily access when building services. This was partly about
runtime efficiency but
mostly about reducing redundancy in the various service building,
contribution, and decorating methods; the ServiceBinder came later, and was a
better solution (trading runtime efficiency for developer ease of
use).</p></rich-text-body><h3
id="ApplicationModuleClassCheatSheet-Thebindmethod">The bind
method</h3><p>Every module may have an optional, static bind() method which is
passed a ServiceBinder. By using the ServiceBinder, you will let Tapestry
<em>autobuild</em> your services. Autobuilding is the <strong>preferred
way</strong> to instantiate your services.</p><plain-text-body>package
org.example.myapp.services;
+ <div id="ConfluenceContent"><p> </p><p>The
<strong>Application Module</strong> class is a simple Java class used to
configure Tapestry. A system of annotations and naming conventions allows
Tapestry to determine what services are provided by the module to your
application. This is the place where you bind your custom implementation of
services, contribute to, decorate and override existing services.</p><p><style
type="text/css">/*<![CDATA[*/
+div.rbtoc1478607610534 {padding: 0px;}
+div.rbtoc1478607610534 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1478607610534 li {margin-left: 0px;padding-left: 0px;}
+
+/*]]>*/</style></p><div class="toc-macro rbtoc1478607610534">
+<ul class="toc-indentation"><li>Related Articles</li></ul>
+<ul><li><a href="#ApplicationModuleClassCheatSheet-Namingconventions">Naming
conventions</a>
+<ul class="toc-indentation"><li><a
href="#ApplicationModuleClassCheatSheet-Thebindmethod">The bind
method</a></li><li><a
href="#ApplicationModuleClassCheatSheet-Servicebuildermethods">Service builder
methods</a></li><li><a
href="#ApplicationModuleClassCheatSheet-Contributemethods">Contribute
methods</a>
+<ul class="toc-indentation"><li><a
href="#ApplicationModuleClassCheatSheet-Unordered">Unordered</a></li></ul>
+</li><li><a href="#ApplicationModuleClassCheatSheet-Decoratemethods">Decorate
methods</a></li></ul>
+</li><li><a
href="#ApplicationModuleClassCheatSheet-Annotations">Annotations</a></li><li><a
href="#ApplicationModuleClassCheatSheet-parameter-typesParametertypes">Parameter
types</a>
+<ul class="toc-indentation"><li><a
href="#ApplicationModuleClassCheatSheet-Configurationparametertypes">Configuration
parameter types</a></li><li><a
href="#ApplicationModuleClassCheatSheet-Linktoservices">Link to
services</a></li><li><a
href="#ApplicationModuleClassCheatSheet-Symbols">Symbols</a></li></ul>
+</li><li><a
href="#ApplicationModuleClassCheatSheet-Loadservicesonregistrystartup">Load
services on registry startup</a></li><li><a
href="#ApplicationModuleClassCheatSheet-Defineservicescope">Define service
scope</a></li><li><a
href="#ApplicationModuleClassCheatSheet-Disambiguateservices">Disambiguate
services</a>
+<ul class="toc-indentation"><li><a
href="#ApplicationModuleClassCheatSheet-WithserviceId">With service
Id</a></li><li><a href="#ApplicationModuleClassCheatSheet-WithMarkers">With
Markers</a></li></ul>
+</li><li><a
href="#ApplicationModuleClassCheatSheet-Overrideexistingservices">Override
existing services</a></li></ul>
+</div><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="application-module-class-cheat-sheet.html">Application Module
Class Cheat Sheet</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="ioc-cookbook-service-configurations.html">IoC cookbook - Service
Configurations</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="symbols.html">Symbols</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="tapestry-ioc-configuration.html">Tapestry IoC 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="response-compression.html">Response Compression</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></ul></div><p>For complete documentation, you should refer to
the <a href="defining-tapestry-ioc-services.html">IOC Service
guideline</a>.</p><h2
id="ApplicationModuleClassCheatSheet-Namingconventions">Naming
conventions</h2><p>The use of naming conventions implies that every public
method of your module class should be meaningful to Tapestry: it either should
follow the naming conventions, or should have an appropriate annotation. Any
extra public methods will result in startup exceptions ... this helps identify
methods names that have typos.</p><p>Methods should be <strong>public</strong>
and, preferably <strong>static</strong>.</p><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>Allowing for non-static methods
may have been a design error, a kind of premature optimization. The thinking
was t
hat the module could have common dependencies that it could then easily access
when building services. This was partly about runtime efficiency but mostly
about reducing redundancy in the various service building, contribution, and
decorating methods; the ServiceBinder came later, and was a better solution
(trading runtime efficiency for developer ease of use).</p></div></div><h3
id="ApplicationModuleClassCheatSheet-Thebindmethod">The bind
method</h3><p>Every module may have an optional, static bind() method which is
passed a ServiceBinder. By using the ServiceBinder, you will let Tapestry
<em>autobuild</em> your services. Autobuilding is the <strong>preferred
way</strong> to instantiate your services.</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;">package org.example.myapp.services;
import org.apache.tapestry5.ioc.ServiceBinder;
@@ -78,7 +126,9 @@ public class MyAppModule
binder.bind(Indexer.class, IndexerImpl.class);
}
}
-</plain-text-body><p>Allowing Tapestry to instantiate your service
implementations means that, during development, they will live-reload.</p><p>Of
course, you can make repeated calls to ServiceBinder.bind(), to bind additional
services.</p><h3
id="ApplicationModuleClassCheatSheet-Servicebuildermethods">Service builder
methods</h3><p>Sometime you need to do more than just instantiate the class
with dependencies. It is common inside Tapestry for one service to be a
listener to events from another service. In that situation (or other similar
ones), a service builder method is useful, as it shifts control back to your
code, where you have the freedom to perform any additional operations necessary
to get the service implementation up and running.</p><plain-text-body>package
org.example.myapp.services;
+</pre>
+</div></div><p>Allowing Tapestry to instantiate your service implementations
means that, during development, they will live-reload.</p><p>Of course, you can
make repeated calls to ServiceBinder.bind(), to bind additional
services.</p><h3
id="ApplicationModuleClassCheatSheet-Servicebuildermethods">Service builder
methods</h3><p>Sometime you need to do more than just instantiate the class
with dependencies. It is common inside Tapestry for one service to be a
listener to events from another service. In that situation (or other similar
ones), a service builder method is useful, as it shifts control back to your
code, where you have the freedom to perform any additional operations necessary
to get the service implementation up and running.</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;">package org.example.myapp.services;
public class MyAppModule
{
@@ -87,7 +137,9 @@ public class MyAppModule
return new IndexerImpl();
}
}
-</plain-text-body><p>Here the service interface is Indexer. Tapestry IoC
doesn't know about the IndexerImpl class (the service implementation of the
Indexer service), but it does know about the build() method. Since Tapestry
isn't instantiating the implementation class, there is no possibility of live
class reloading.</p><p>Here's a more complicated example:</p><plain-text-body>
@Marker(ClasspathProvider.class)
+</pre>
+</div></div><p>Here the service interface is Indexer. Tapestry IoC doesn't
know about the IndexerImpl class (the service implementation of the Indexer
service), but it does know about the build() method. Since Tapestry isn't
instantiating the implementation class, there is no possibility of live class
reloading.</p><p>Here's a more complicated example:</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;"> @Marker(ClasspathProvider.class)
public static AssetFactory buildClasspathAssetFactory(ResourceCache
resourceCache,
ClasspathAssetAliasManager aliasManager, AssetPathConverter
converter)
{
@@ -97,25 +149,32 @@ public class MyAppModule
return factory;
}
-</plain-text-body><p>What's important in this example is that
ClasspathAssetFactory, the implementation class, implements the
InvalidationListener interface. AssetFactory, the service interface, does
<strong>not</strong> extend the InvalidationListener interface.</p><p>Tapestry
has evolved some additional tools to "have your cake and eat it too"; the @<a
class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/annotations/Autobuild.html">Autobuild</a>
annotation takes care of instantiating a service implementation, with
dependencies, allowing your code to focus on the extra initialization logic,
and not on the dependencies:</p><plain-text-body> public static
PersistentFieldStrategy buildClientPersistentFieldStrategy(LinkCreationHub
linkCreationHub, @Autobuild
+</pre>
+</div></div><p>What's important in this example is that ClasspathAssetFactory,
the implementation class, implements the InvalidationListener interface.
AssetFactory, the service interface, does <strong>not</strong> extend the
InvalidationListener interface.</p><p>Tapestry has evolved some additional
tools to "have your cake and eat it too"; the @<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/annotations/Autobuild.html">Autobuild</a>
annotation takes care of instantiating a service implementation, with
dependencies, allowing your code to focus on the extra initialization logic,
and not on the dependencies:</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 PersistentFieldStrategy
buildClientPersistentFieldStrategy(LinkCreationHub linkCreationHub, @Autobuild
ClientPersistentFieldStrategy service)
{
linkCreationHub.addListener(service);
return service;
}
-</plain-text-body><h3
id="ApplicationModuleClassCheatSheet-Contributemethods">Contribute
methods</h3><p>One of the key concepts on Tapestry IoC is <strong>distributed
configuration</strong> to provide extensibility and modularity. The distributed
part refers to the fact that any module may make contributions to any service's
configuration. The extensibility comes from the fact multiple modules may all
contribute to the same service configuration. There exist three styles of
configuration with matching contributions, and every Tapestry service is marked
with an annotation to indicate the type of configuration it requires</p><h4
id="ApplicationModuleClassCheatSheet-Unordered">Unordered</h4><p>Services will
be annotated with @<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/annotations/UsesConfiguration.html">UsesConfiguration</a>.</p><p>For
example, here's a kind of tapestry internal service that requires a list of
Coercion tuples to
be able to coerce values from one type to another (i.e. from string to the
target type when reading values from the HTTP
request)</p><plain-text-body>public
TypeCoercerImpl(Collection<CoercionTuple> tuples)
+</pre>
+</div></div><h3
id="ApplicationModuleClassCheatSheet-Contributemethods">Contribute
methods</h3><p>One of the key concepts on Tapestry IoC is <strong>distributed
configuration</strong> to provide extensibility and modularity. The distributed
part refers to the fact that any module may make contributions to any service's
configuration. The extensibility comes from the fact multiple modules may all
contribute to the same service configuration. There exist three styles of
configuration with matching contributions, and every Tapestry service is marked
with an annotation to indicate the type of configuration it requires</p><h4
id="ApplicationModuleClassCheatSheet-Unordered">Unordered</h4><p>Services will
be annotated with @<a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/annotations/UsesConfiguration.html">UsesConfiguration</a>.</p><p>For
example, here's a kind of tapestry internal service that requires a list of
Coercion tuples to be abl
e to coerce values from one type to another (i.e. from string to the target
type when reading values from the HTTP request)</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 TypeCoercerImpl(Collection<CoercionTuple>
tuples)
{
// ...
}
-</plain-text-body><p>On the contribution side, a service contribution method
sees a Configuration object:</p><plain-text-body>public static void
contributeTypeCoercer(Configuration<CoercionTuple> configuration) {
+</pre>
+</div></div><p>On the contribution side, a service contribution method sees a
Configuration object:</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
contributeTypeCoercer(Configuration<CoercionTuple> configuration) {
{
// Create Coercion tuple here
// ...
configuration.add(myTuple);
}
-</plain-text-body><h3
id="ApplicationModuleClassCheatSheet-Decoratemethods">Decorate
methods</h3><p><em>content under development</em></p><h2
id="ApplicationModuleClassCheatSheet-Annotations">Annotations</h2><p>Main
Article: <a href="annotations.html">Annotations</a></p><p>Tapestry 5.2 comes
with a set of annotations to better your understanding of module
classes.</p><p><em>content under development</em></p><h2
id="ApplicationModuleClassCheatSheet-parameter-typesParametertypes"><parameter
ac:name="">parameter-types</parameter>Parameter types</h2><p>These methods may
have any number of parameters, tapestry will try to resolve each parameter
value as a configuration element or a registry element.</p><h3
id="ApplicationModuleClassCheatSheet-Configurationparametertypes">Configuration
parameter types</h3><p><em>content under development</em></p><h3
id="ApplicationModuleClassCheatSheet-Linktoservices">Link to
services</h3><p><em>content under development</em></p><h3 id="ApplicationModule
ClassCheatSheet-Symbols">Symbols</h3><p>Main Article: <a
href="symbols.html">Symbols</a></p><p><em>content under development</em></p><h2
id="ApplicationModuleClassCheatSheet-Loadservicesonregistrystartup">Load
services on registry startup</h2><p><em>content under development</em></p><h2
id="ApplicationModuleClassCheatSheet-Defineservicescope">Define service
scope</h2><p><em>content under development</em></p><h2
id="ApplicationModuleClassCheatSheet-Disambiguateservices">Disambiguate
services</h2><p><em>content under development</em></p><h3
id="ApplicationModuleClassCheatSheet-WithserviceId">With service
Id</h3><p><em>content under development</em></p><h3
id="ApplicationModuleClassCheatSheet-WithMarkers">With
Markers</h3><p><em>content under development</em></p><h2
id="ApplicationModuleClassCheatSheet-Overrideexistingservices">Override
existing services</h2><p><em>content under
development</em></p><p> </p><p></p></div>
+</pre>
+</div></div><h3 id="ApplicationModuleClassCheatSheet-Decoratemethods">Decorate
methods</h3><p><em>content under development</em></p><h2
id="ApplicationModuleClassCheatSheet-Annotations">Annotations</h2><p>Main
Article: <a href="annotations.html">Annotations</a></p><p>Tapestry 5.2 comes
with a set of annotations to better your understanding of module
classes.</p><p><em>content under development</em></p><h2
id="ApplicationModuleClassCheatSheet-parameter-typesParametertypes"><span
class="confluence-anchor-link"
id="ApplicationModuleClassCheatSheet-parameter-types"></span>Parameter
types</h2><p>These methods may have any number of parameters, tapestry will try
to resolve each parameter value as a configuration element or a registry
element.</p><h3
id="ApplicationModuleClassCheatSheet-Configurationparametertypes">Configuration
parameter types</h3><p><em>content under development</em></p><h3
id="ApplicationModuleClassCheatSheet-Linktoservices">Link to
services</h3><p><em>content under de
velopment</em></p><h3
id="ApplicationModuleClassCheatSheet-Symbols">Symbols</h3><p>Main Article: <a
href="symbols.html">Symbols</a></p><p><em>content under development</em></p><h2
id="ApplicationModuleClassCheatSheet-Loadservicesonregistrystartup">Load
services on registry startup</h2><p><em>content under development</em></p><h2
id="ApplicationModuleClassCheatSheet-Defineservicescope">Define service
scope</h2><p><em>content under development</em></p><h2
id="ApplicationModuleClassCheatSheet-Disambiguateservices">Disambiguate
services</h2><p><em>content under development</em></p><h3
id="ApplicationModuleClassCheatSheet-WithserviceId">With service
Id</h3><p><em>content under development</em></p><h3
id="ApplicationModuleClassCheatSheet-WithMarkers">With
Markers</h3><p><em>content under development</em></p><h2
id="ApplicationModuleClassCheatSheet-Overrideexistingservices">Override
existing services</h2><p><em>content under
development</em></p><p> </p><p></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 Wed Sep 20 12:29:16 2017
@@ -27,6 +27,15 @@
</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>
+ SyntaxHighlighter.defaults['toolbar'] = false;
+ SyntaxHighlighter.all();
+ </script>
<link href="/styles/style.css" rel="stylesheet" type="text/css"/>
@@ -36,26 +45,13 @@
<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>
@@ -67,44 +63,98 @@
</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><parameter ac:name="style">float:right</parameter><parameter
ac:name="title">Related Articles</parameter><parameter
ac:name="class">aui-label</parameter><rich-text-body><parameter
ac:name="showLabels">false</parameter><parameter
ac:name="showSpace">false</parameter><parameter ac:name="title">Related
Articles</parameter><parameter ac:name="cql">label in ("assets","response") and
space = currentSpace()</parameter></rich-text-body><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/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 app
lication's context folder, and the "asset:" prefix is for assets from the
classpath.</p><parameter ac:name="language">xml</parameter><parameter
ac:name="title">src/main/webapp/com/example/myapp/images/tapestry_banner.gif</parameter><plain-text-body><img
src="${context:images/tapestry_banner.gif}"/>
-</plain-text-body><rich-text-body><p>This is an example of using a
<em>template expansion</em> inside an ordinary element (rather than a
component).</p></rich-text-body><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/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>
<parameter ac:name="language">java</parameter><plain-text-body>@Inject
+ <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">
+<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">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Inject
@Path("context:images/tapestry_banner.gif")
private Asset banner;
-</plain-text-body><p>Assets are located within <em>domains</em>; these domains
are identified by the prefix on the @Path annotation's
<code>value</code>.</p><h3
id="Assets-META-INF/assets">META-INF/assets</h3><p>Support for storing assets
under <code>META-INF/assets</code> was added in Tapestry 5.4.</p><p>For
security reasons (detailed below), it is best to have the assets that will be
exposed to the client segregated from compiled Java classes. For that reason,
classpath assets must be stored in <code>META-INF/assets</code> or a
subfolder.</p><p>For an <em>application</em> asset, the assets can be
stored directly in <code>META-INF/assets</code>.</p><p>For
a <em>library</em> asset, Tapestry uses the library's name (from its
LibraryMapping) (such as "core" for the Tapestry core library);  The
library name becomes a folder under <code>META-INF/assets</code>; for
example, Tapestry stores its component-related assets
under <code>META-INF/assets/co
re</code>.</p><h3 id="Assets-ClasspathAssets">Classpath Assets </h3><p>If
the prefix is omitted, the value will be interpreted as a path relative to the
Java class file itself, within the "classpath:" domain. This is often used when
creating component libraries, where the assets used by the components are
packaged in the JAR with the components themselves.</p><p>Unlike elsewhere in
Tapestry, <em>case matters</em>. This is because Tapestry is dependent on the
Servlet API and the Java runtime to access the underlying files, and those
APIs, unlike Tapestry, are case sensitive. Be aware that some <em>operating
systems</em> (such as Windows) are case insensitive, which may mask errors that
will be revealed at deployment (if the deployment operating system is case
sensitive, such as Linux).</p><p>In Tapestry 5.3 and earlier, classpath assets
are packaged in the same folder as the compiled Java class (as well as
component templates and so forth). Relative assets are based on this loca
tion, the location of the component's .class file.</p><p>In Tapestry 5.4, this
is supported (but will generate a runtime warning). Classpath resources are
expected to be stored under <code>META-INF/assets</code>.</p><p>In
Tapestry 5.5, support for classpath assets <strong>not</strong>
under <code>META-INF/assets</code> may be removed.</p><h3
id="Assets-RelativeAssets">Relative Assets</h3><p>You can use relative paths
with domains (if you omit the prefix):</p><parameter
ac:name="language">java</parameter><plain-text-body>@Inject
+</pre>
+</div></div><p>Assets are located within <em>domains</em>; these domains are
identified by the prefix on the @Path annotation's <code>value</code>.</p><h3
id="Assets-META-INF/assets">META-INF/assets</h3><p>Support for storing assets
under <code>META-INF/assets</code> was added in Tapestry 5.4.</p><p>For
security reasons (detailed below), it is best to have the assets that will be
exposed to the client segregated from compiled Java classes. For that reason,
classpath assets must be stored in <code>META-INF/assets</code> or a
subfolder.</p><p>For an <em>application</em> asset, the assets can be
stored directly in <code>META-INF/assets</code>.</p><p>For
a <em>library</em> asset, Tapestry uses the library's name (from its
LibraryMapping) (such as "core" for the Tapestry core library);  The
library name becomes a folder under <code>META-INF/assets</code>; for
example, Tapestry stores its component-related assets
under <code>META-INF/assets/core</co
de>.</p><h3 id="Assets-ClasspathAssets">Classpath Assets </h3><p>If the
prefix is omitted, the value will be interpreted as a path relative to the Java
class file itself, within the "classpath:" domain. This is often used when
creating component libraries, where the assets used by the components are
packaged in the JAR with the components themselves.</p><p>Unlike elsewhere in
Tapestry, <em>case matters</em>. This is because Tapestry is dependent on the
Servlet API and the Java runtime to access the underlying files, and those
APIs, unlike Tapestry, are case sensitive. Be aware that some <em>operating
systems</em> (such as Windows) are case insensitive, which may mask errors that
will be revealed at deployment (if the deployment operating system is case
sensitive, such as Linux).</p><p>In Tapestry 5.3 and earlier, classpath assets
are packaged in the same folder as the compiled Java class (as well as
component templates and so forth). Relative assets are based on this location,
the location of the component's .class file.</p><p>In Tapestry 5.4, this is
supported (but will generate a runtime warning). Classpath resources are
expected to be stored under <code>META-INF/assets</code>.</p><p>In
Tapestry 5.5, support for classpath assets <strong>not</strong>
under <code>META-INF/assets</code> may be removed.</p><h3
id="Assets-RelativeAssets">Relative Assets</h3><p>You can use relative paths
with domains (if you omit the prefix):</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("images/edit.png")
private Asset icon;
-</plain-text-body><p>This represents a relative path from the default location
for the asset. For Tapestry 5.4, this will resolve as either relative to the
component's class file (the logic for Tapestry 5.3 and earlier), or relative to
the correct folder within <code>META-INF/assets</code> (the logic for
Tapestry 5.4 and later).</p><p>You may use the standard <code>./</code>
and <code>../</code> prefixes to refer to the current folder, and
containing folder, respectfully.</p><p>Since you must omit the asset domain
prefix in order to specify a relative path, this only makes sense for
components packaged in a library for reuse.</p><h3
id="Assets-SymbolsForAssets">Symbols For Assets</h3><p>Symbols inside the
annotation value are expanded. This allows you to define a symbol and reference
it as part of the path. For example, you could contribute a symbol named
"skin.root" as "context:skins/basic" and then reference an asset from within
it:</p><parameter ac:name="language">
java</parameter><plain-text-body>@Inject
+</pre>
+</div></div><p>This represents a relative path from the default location for
the asset. For Tapestry 5.4, this will resolve as either relative to the
component's class file (the logic for Tapestry 5.3 and earlier), or relative to
the correct folder within <code>META-INF/assets</code> (the logic for
Tapestry 5.4 and later).</p><p>You may use the standard <code>./</code>
and <code>../</code> prefixes to refer to the current folder, and
containing folder, respectfully.</p><p>Since you must omit the asset domain
prefix in order to specify a relative path, this only makes sense for
components packaged in a library for reuse.</p><h3
id="Assets-SymbolsForAssets">Symbols For Assets</h3><p>Symbols inside the
annotation value are expanded. This allows you to define a symbol and reference
it as part of the path. For example, you could contribute a symbol named
"skin.root" as "context:skins/basic" and then reference an asset from within
it:</p><div class="code panel pdl" style="b
order-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Inject
@Path("${skin.root}/style.css")
private Asset style;
-</plain-text-body><rich-text-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></rich-text-body><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 Domains</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://t
apestry.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><rich-text-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></rich-text-body><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-height:
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 ".p
roperties". 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><parameter ac:name="language">java</parameter><parameter
ac:name="title">AppModule.java (partial)</parameter><plain-text-body>public
static void contributeResourceDigestGenerator(Configuration<String>
configuration)
+</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">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">public static void
contributeResourceDigestGenerator(Configuration<String> configuration)
{
configuration.add("xyz");
}
-</plain-text-body><rich-text-body><p>Starting in Tapestry 5.4, there is a move
to ensure that all assets are stored under <code>META-INF/assets</code>,
rather than on the general classpath.</p><p>In Tapestry 5.5 and later, assets
on the general classpath may not be supported at all.</p></rich-text-body><h3
id="Assets-MinimizingAssets">Minimizing Assets</h3><p>Since version 5.3,
Tapestry provides a service, <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/assets/ResourceMinimizer.html">ResourceMinimizer</a>,
which will help to minimize all your static resources (principally CSS and
JavaScript files).</p><p>Minimization takes place before GZip compression. When
aggregating JavaScript for a JavaScriptStack, the minimization is on the
aggregated asset, not the individual assets being aggregated.</p><p>By default,
this service does nothing. You should include a the tapestry-yuicompressor
library (for Tapestry 5.3) or tapes
try-webresources (for Tapestry 5.4), which makes it possible to minimize CSS
and JavaScript files.</p><rich-text-body><rich-text-body><parameter
ac:name="language">xml</parameter><parameter ac:name="title">For Tapestry 5.3:
pom.xml (partial)</parameter><plain-text-body><dependency>
+</pre>
+</div></div><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>Starting in Tapestry 5.4, there is
a move to ensure that all assets are stored
under <code>META-INF/assets</code>, rather than on the general
classpath.</p><p>In Tapestry 5.5 and later, assets on the general classpath may
not be supported at all.</p></div></div><h3
id="Assets-MinimizingAssets">Minimizing Assets</h3><p>Since version 5.3,
Tapestry provides a service, <a class="external-link"
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/assets/ResourceMinimizer.html">ResourceMinimizer</a>,
which will help to minimize all your static resources (principally CSS and
JavaScript files).</p><p>Minimization takes place before GZip compression. When
aggregating JavaScript for a JavaScriptStack, the minimization is on th
e aggregated asset, not the individual assets being aggregated.</p><p>By
default, this service does nothing. You should include a
the tapestry-yuicompressor library (for Tapestry 5.3) or
tapestry-webresources (for Tapestry 5.4), which makes it possible to minimize
CSS and JavaScript files.</p><div class="sectionColumnWrapper"><div
class="sectionMacro"><div class="sectionMacroRow"><div class="columnMacro"><div
class="code panel pdl" style="border-width: 1px;"><div class="codeHeader
panelHeader pdl" style="border-bottom-width: 1px;"><b>For Tapestry 5.3: pom.xml
(partial)</b></div><div class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-yuicompressor</artifactId>
<version>5.3.1</version>
</dependency>
-</plain-text-body></rich-text-body><rich-text-body><parameter
ac:name="language">xml</parameter><parameter
ac:name="lang">xml</parameter><parameter ac:name="title">For Tapestry 5.4:
pom.xml (partial)</parameter><plain-text-body><dependency>
+</pre>
+</div></div></div><div class="columnMacro"><div class="code panel pdl"
style="border-width: 1px;"><div class="codeHeader panelHeader pdl"
style="border-bottom-width: 1px;"><b>For Tapestry 5.4: pom.xml
(partial)</b></div><div class="codeContent panelContent pdl">
+<pre class="brush: xml; gutter: false; theme: Default"
style="font-size:12px;"><dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-webresources</artifactId>
<version>5.4</version>
</dependency>
-</plain-text-body></rich-text-body></rich-text-body><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><parameter ac:name="language">java</parameter><parameter
ac:name="title">AppModule.java
(partial)</parameter><plain-text-body>@Contribute(SymbolProvider.class)
+</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">
+<pre class="brush: java; gutter: false; theme: Default"
style="font-size:12px;">@Contribute(SymbolProvider.class)
@ApplicationDefaults
public static void
contributeApplicationDefaults(MappedConfiguration<String, String>
configuration)
{
configuration.add(SymbolConstants.MINIFICATION_ENABLED, "true");
}
-</plain-text-body><p>If you want to add your own minimizer for particular
types of assets, you can contribute to the ResourceMinimizer service. The
service configuration maps the MIME-TYPE of your resource to an implementation
of the ResourceMinimizer interface.</p><parameter
ac:name="language">java</parameter><parameter ac:name="title">AppModule.java
(partial)</parameter><plain-text-body>@Contribute(ResourceMinimizer.class)
+</pre>
+</div></div><p>If you want to add your own minimizer for particular types of
assets, you can contribute to the ResourceMinimizer service. The service
configuration maps the MIME-TYPE of your resource to an implementation of the
ResourceMinimizer interface.</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(ResourceMinimizer.class)
@Primary
public static void contributeMinimizers(MappedConfiguration<String,
ResourceMinimizer> configuration)
{
configuration.addInstance("text/coffeescript",
CoffeeScriptMinimizer.class);
}
-</plain-text-body><p> </p><p> </p><p> </p></div>
+</pre>
+</div></div><p> </p><p> </p><p> </p></div>
</div>
<div class="clearer"></div>