You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by bu...@apache.org on 2015/08/08 20:20:03 UTC

svn commit: r961174 [2/2] - in /websites/production/tapestry/content: ./ cache/

Modified: websites/production/tapestry/content/starting-the-ioc-registry.html
==============================================================================
--- websites/production/tapestry/content/starting-the-ioc-registry.html (original)
+++ websites/production/tapestry/content/starting-the-ioc-registry.html Sat Aug  8 18:20:03 2015
@@ -31,8 +31,6 @@
   <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 type="text/javascript">
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -83,7 +81,7 @@ registry.performRegistryStartup();</pre>
 <p>&#160;</p></div><p>As of version 5.2 the class <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/RegistryBuilder.html">RegistryBuilder</a> has convenience methods to build and start a Registry. The static method <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/RegistryBuilder.html#buildAndStartupRegistry(java.lang.Class...)">RegistryBuilder.buildAndStartupRegistry(Class...)</a> constructs a registry, adds a number of modules to the registry and performs registry startup. The returned registry is ready to use.</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;">Registry registry = RegistryBuilder.buildAndStartupRegistry(AppModule.class, UtilModule.class);
 </pre>
-</div></div><h1 id="StartingtheIoCRegistry-BuildingtheDefaultRegistry">Building the Default Registry</h1><p>The default registry is available by invoking the static method <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/IOCUtilities.html#buildDefaultRegistry">IOCUtilities.buildDefaultRegistry()</a>. This method builds a Registry using <a shape="rect" href="autoloading-modules.html">autoloading logic</a>, where modules to load are identified via a JAR Manifest entry.</p><p>In addition, the JVM system property <code>tapestry.modules</code> (if specified) is a list of additional module classes to load. This is often used in development, where tests may be executed against the local classes, not JARs, and so there is no manifest to read.</p><h1 id="StartingtheIoCRegistry-ShuttingdowntheRegistry">Shutting down the Registry</h1><p>The method <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidoc
 s/org/apache/tapestry5/ioc/Registry.html#shutdown">Registry.shutdown()</a> will shutdown the Registry. This immediately invalidates all service proxies. Some services may have chosen to register for shutdown notification (for example, to do cleanup work such as closing a database connection).</p><p>Once the Registry is shutdown, it may not be used again: it will not be possible to access services within the Registry, or invoke methods on services previously acquired. All you can do is release the Registry to the garbage collector.</p></div>
+</div></div><h1 id="StartingtheIoCRegistry-BuildingtheDefaultRegistry">Building the Default Registry</h1><p>The default registry is available by invoking the static method <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/IOCUtilities.html#buildDefaultRegistry">IOCUtilities.buildDefaultRegistry()</a>. This method builds a Registry using <a shape="rect" href="autoloading-modules.html">autoloading logic</a>, where modules to load are identified via a JAR Manifest entry.</p><p>In addition, the JVM system property <code>tapestry.modules</code> (if specified) is a list of additional module classes to load. This is often used in development, where tests may be executed against the local classes, not JARs, and so there is no manifest to read.</p><h1 id="StartingtheIoCRegistry-ShuttingdowntheRegistry">Shutting down the Registry</h1><p>The method <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidoc
 s/org/apache/tapestry5/ioc/Registry.html#shutdown">Registry.shutdown()</a> will shutdown the Registry. This immediately invalidates all service proxies. Some services may have chosen to register for shutdown notification (for example, to do cleanup work such as closing a database connection).</p><p>Once the Registry is shutdown, it may not be used again: it will not be possible to access services within the Registry, or invoke methods on services previously acquired. All you can do is release the Registry to the garbage collector.</p><p>&#160;</p><p></p></div>
 </div>
 
 <div class="clearer"></div>

Modified: websites/production/tapestry/content/tapestry-for-jsf-users.html
==============================================================================
--- websites/production/tapestry/content/tapestry-for-jsf-users.html (original)
+++ websites/production/tapestry/content/tapestry-for-jsf-users.html Sat Aug  8 18:20:03 2015
@@ -32,7 +32,6 @@
   <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 type="text/javascript">
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -67,7 +66,7 @@
   </div>
 
 <div id="content">
-<div id="ConfluenceContent"><p>This is&#160;a brief guide for learning Tapestry, designed for those who already know JavaServer Faces (JSF).</p><p>Because both JSF and Tapestry are component oriented frameworks designed to serve mostly the same kinds of problems in similar ways, developers who already know JSF will find it very easy to learn Tapestry. In fact, Facelets, the default view technology in JSF 2.0, was created specifically to give JSF a Tapestry-like templating capability, so Facelets users should feel right at home.</p><div class="aui-label" style="float:right" title="Related Articles">
+<div id="ConfluenceContent"><p>&#160;</p><p>This is&#160;a brief guide for learning Tapestry, designed for those who already know JavaServer Faces (JSF).</p><p>Because both JSF and Tapestry are component oriented frameworks designed to serve mostly the same kinds of problems in similar ways, developers who already know JSF will find it very easy to learn Tapestry. In fact, Facelets, the default view technology in JSF 2.0, was created specifically to give JSF a Tapestry-like templating capability, so Facelets users should feel right at home.</p><div class="aui-label" style="float:right" title="Related Articles">
 
 
 
@@ -161,7 +160,7 @@ public class HelloWorldBean {
     private String lastName;
     @NotNull @Email private String email;
 </pre>
-</div></div><h3 id="TapestryforJSFUsers-Post-Redirect-GetNavigation">Post-Redirect-Get Navigation</h3><p>By default, most JSF URLs are "one page behind". That is, when you click on an &lt;h:commandLink&gt; link or submit a form, the request goes back to the originating page, and the server returns the contents of the <strong>next</strong> page &#8211; but the URL in the browser shows the previous page's URL. To fix this in JSF you add the "?faces-redirect=true" to the URL you return from event handlers, which causes JSF to send a redirect to the browser to navigate to the next page.</p><p>By contrast, Tapestry implements this Post-Redirect-Get pattern by default. The URL will always reflect the page you're seeing, not the page you just came from.</p><p>Note that by default Tapestry does not save property values across the Post-Redirect-Get cycle. This means that you have to consider how (and whether) to persist property values from one page to the next. The usual solution is to eith
 er make the values part of the page's <a shape="rect" href="navigation.html">Activation Context</a> (which means the values will be appended to the URL) or <a shape="rect" href="persistent-page-data.html">@Persist the properties</a> the values in the session.</p><h2 id="TapestryforJSFUsers-CustomandCompositeComponents">Custom and Composite Components</h2><p>With JSF, creating custom components is an <a shape="rect" class="external-link" href="http://jsfcorner.blogspot.com/2011/01/custom-components.html" >advanced topic</a>. In fact, many JSF developers have <em>never</em> created a custom component. In JSF 1.x, creating each custom component requires a lot of work: creating 3 Java classes (component, component renderer and component tag), registering the component in an XML file, and registering the tag in the .tld file. In JSF 2.x <em>composite components</em> can be created without too much work (if your needs can be met by combining existing components <em>and</em> you don't need
  any custom Java), but you still have to use cumbersome &lt;composite:interface&gt; and &lt;composite:implementation&gt; tags in your component templates, and you have to list the composite components in the xml namespace declaration at the top of the pages where you are using them.</p><p>Creating true custom components in JSF 2.0 still requires several steps: create a component class (generally having the @FacesComponent annotation and extending UIComponentBase), create a renderer class (generally extending Renderer), add a &lt;renderer&gt; section to the facesconfig file, and create a *-taglib.xml file in the WEB_INF folder that defines the namespace, tag and component type of the custom component.</p><p>In contrast, with Tapestry, <a shape="rect" href="component-classes.html">creating custom components</a> is a <em>beginner</em> topic: it is expected to be a daily activity for developers, because it is so easy. In fact, the steps are the same as creating a page. All you have to d
 o is create a (potentially empty) Java class in a "components" sub-package, and create a template file containing (X)HTML markup in the corresponding "components" sub-folder within your package hierarchy under /src/main/resources. You <em>use</em> a custom component just like you use any built-in Tapestry component: <code>&lt;t:mycomponent&gt;</code>.</p><p>Because they're so easy to create, Tapestry applications tend to have a lot of custom components and much less repetition of HTML than most JSF applications.</p><h2 id="TapestryforJSFUsers-OtherReferences">Other References</h2><ul><li><a shape="rect" class="external-link" href="http://blog.tapestry5.de/wp-content/uploads/2010/06/JSF-2.0-vs-Tapestry-5.pdf" >JavaServer Faces 2.0 vs. Tapestry 5: A Head-to-Head Comparison</a> slides by Igor Drobiazko, June 2010.</li><li><a shape="rect" class="external-link" href="http://docs.oracle.com/javaee/6/tutorial/doc/gkhxa.html" >Composite Components: Advanced Topics and Example</a> part of <e
 m>The Java EE 6 Tutorial</em> from Oracle</li></ul><p></p></div>
+</div></div><h3 id="TapestryforJSFUsers-Post-Redirect-GetNavigation">Post-Redirect-Get Navigation</h3><p>By default, most JSF URLs are "one page behind". That is, when you click on an &lt;h:commandLink&gt; link or submit a form, the request goes back to the originating page, and the server returns the contents of the <strong>next</strong> page &#8211; but the URL in the browser shows the previous page's URL. To fix this in JSF you add the "?faces-redirect=true" to the URL you return from event handlers, which causes JSF to send a redirect to the browser to navigate to the next page.</p><p>By contrast, Tapestry implements this Post-Redirect-Get pattern by default. The URL will always reflect the page you're seeing, not the page you just came from.</p><p>Note that by default Tapestry does not save property values across the Post-Redirect-Get cycle. This means that you have to consider how (and whether) to persist property values from one page to the next. The usual solution is to eith
 er make the values part of the page's <a shape="rect" href="navigation.html">Activation Context</a> (which means the values will be appended to the URL) or <a shape="rect" href="persistent-page-data.html">@Persist the properties</a> the values in the session.</p><h2 id="TapestryforJSFUsers-CustomandCompositeComponents">Custom and Composite Components</h2><p>With JSF, creating custom components is an <a shape="rect" class="external-link" href="http://jsfcorner.blogspot.com/2011/01/custom-components.html" >advanced topic</a>. In fact, many JSF developers have <em>never</em> created a custom component. In JSF 1.x, creating each custom component requires a lot of work: creating 3 Java classes (component, component renderer and component tag), registering the component in an XML file, and registering the tag in the .tld file. In JSF 2.x <em>composite components</em> can be created without too much work (if your needs can be met by combining existing components <em>and</em> you don't need
  any custom Java), but you still have to use cumbersome &lt;composite:interface&gt; and &lt;composite:implementation&gt; tags in your component templates, and you have to list the composite components in the xml namespace declaration at the top of the pages where you are using them.</p><p>Creating true custom components in JSF 2.0 still requires several steps: create a component class (generally having the @FacesComponent annotation and extending UIComponentBase), create a renderer class (generally extending Renderer), add a &lt;renderer&gt; section to the facesconfig file, and create a *-taglib.xml file in the WEB_INF folder that defines the namespace, tag and component type of the custom component.</p><p>In contrast, with Tapestry, <a shape="rect" href="component-classes.html">creating custom components</a> is a <em>beginner</em> topic: it is expected to be a daily activity for developers, because it is so easy. In fact, the steps are the same as creating a page. All you have to d
 o is create a (potentially empty) Java class in a "components" sub-package, and create a template file containing (X)HTML markup in the corresponding "components" sub-folder within your package hierarchy under /src/main/resources. You <em>use</em> a custom component just like you use any built-in Tapestry component: <code>&lt;t:mycomponent&gt;</code>.</p><p>Because they're so easy to create, Tapestry applications tend to have a lot of custom components and much less repetition of HTML than most JSF applications.</p><h2 id="TapestryforJSFUsers-OtherReferences">Other References</h2><ul><li><a shape="rect" class="external-link" href="http://blog.tapestry5.de/wp-content/uploads/2010/06/JSF-2.0-vs-Tapestry-5.pdf" >JavaServer Faces 2.0 vs. Tapestry 5: A Head-to-Head Comparison</a> slides by Igor Drobiazko, June 2010.</li><li><a shape="rect" class="external-link" href="http://docs.oracle.com/javaee/6/tutorial/doc/gkhxa.html" >Composite Components: Advanced Topics and Example</a> part of <e
 m>The Java EE 6 Tutorial</em> from Oracle</li></ul><p>&#160;</p><p></p></div>
 </div>
 
 <div class="clearer"></div>

Modified: websites/production/tapestry/content/using-jsr-330-standard-annotations.html
==============================================================================
--- websites/production/tapestry/content/using-jsr-330-standard-annotations.html (original)
+++ websites/production/tapestry/content/using-jsr-330-standard-annotations.html Sat Aug  8 18:20:03 2015
@@ -31,8 +31,6 @@
   <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 type="text/javascript">
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -245,7 +243,7 @@ public @interface French {
 
    ...
 }</pre>
-</div></div><h1 id="UsingJSR330standardannotations-Scopes">Scopes</h1><p>By default, a JSR-330 injector creates an instance, uses the instance for one injection, and then forgets it. By placing the&#160;<a shape="rect" class="external-link" href="http://atinject.googlecode.com/svn/trunk/javadoc/javax/inject/Scope.html" >@Scope</a>&#160;annotation you can tell the injector to retain the instance for possible reuse in a later injection. If you want a service to be a singleton, you need to use the&#160;<a shape="rect" class="external-link" href="http://atinject.googlecode.com/svn/trunk/javadoc/javax/inject/Singleton.html" >@Singleton</a>&#160;annotation.</p><p>In Tapestry, it is exactly the other way around. By default a service is a singleton. Once an instance is created, it is reused for injection. Another available scope is <em>perthread</em>, which exists primarily to help multi-threaded servlet applications. If a service has <em>perthread</em>&#160;scope, it is recreated for every
  incoming request.</p></div>
+</div></div><h1 id="UsingJSR330standardannotations-Scopes">Scopes</h1><p>By default, a JSR-330 injector creates an instance, uses the instance for one injection, and then forgets it. By placing the&#160;<a shape="rect" class="external-link" href="http://atinject.googlecode.com/svn/trunk/javadoc/javax/inject/Scope.html" >@Scope</a>&#160;annotation you can tell the injector to retain the instance for possible reuse in a later injection. If you want a service to be a singleton, you need to use the&#160;<a shape="rect" class="external-link" href="http://atinject.googlecode.com/svn/trunk/javadoc/javax/inject/Singleton.html" >@Singleton</a>&#160;annotation.</p><p>In Tapestry, it is exactly the other way around. By default a service is a singleton. Once an instance is created, it is reused for injection. Another available scope is <em>perthread</em>, which exists primarily to help multi-threaded servlet applications. If a service has <em>perthread</em>&#160;scope, it is recreated for every
  incoming request.</p><p>&#160;</p><p></p></div>
 </div>
 
 <div class="clearer"></div>