Modified: websites/production/tapestry/content/logging-in-tapestry.html
==============================================================================
--- websites/production/tapestry/content/logging-in-tapestry.html (original)
+++ websites/production/tapestry/content/logging-in-tapestry.html Sat Jan 18 
18:21:05 2014
@@ -29,6 +29,7 @@
   <link 
href='http://cxf.apache.org/resources/highlighter/styles/shThemeCXF.css' 
rel='stylesheet' type='text/css' />
   <script src='http://cxf.apache.org/resources/highlighter/scripts/shCore.js' 
type='text/javascript'></script>
   <script 
src='http://cxf.apache.org/resources/highlighter/scripts/shBrushJava.js' 
type='text/javascript'></script>
+  <script 
src='http://cxf.apache.org/resources/highlighter/scripts/shBrushXml.js' 
type='text/javascript'></script>
   <script type="text/javascript">
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -77,9 +78,7 @@ table.ScrollbarTable td.ScrollbarParent 
 table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
 table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 
16px;border: none;}
 
-/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td 
colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" 
href="parallel-execution.html"><img align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/back_16.gif"; width="16" 
height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" 
width="33%"><a shape="rect" href="parallel-execution.html">Parallel 
Execution</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" 
width="33%"><sup><a shape="rect" href="ioc.html"><img align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/up_16.gif"; width="8" 
height="8"></a></sup><a shape="rect" href="ioc.html">IoC</a></td><td 
colspan="1" rowspan="1" class="ScrollbarNextName" width="33%">&#160;<a 
shape="rect" href="using-jsr-330-standard-annotations.html">Using JSR 330 
standard annotations</a></td><td colspan="1" rowspan="1" 
class="ScrollbarNextIcon"><a shape="rect" href="using-jsr-330-standard
 -annotations.html"><img align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif"; width="16" 
height="16"></a></td></tr></table></div>
-
-<div class="navmenu" style="float:right; background:#eee; margin:3px; 
padding:3px">
+/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td 
colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" 
href="parallel-execution.html"><img align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/back_16.gif"; width="16" 
height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" 
width="33%"><a shape="rect" href="parallel-execution.html">Parallel 
Execution</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" 
width="33%"><sup><a shape="rect" href="ioc.html"><img align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/up_16.gif"; width="8" 
height="8"></a></sup><a shape="rect" href="ioc.html">IoC</a></td><td 
colspan="1" rowspan="1" class="ScrollbarNextName" width="33%">&#160;<a 
shape="rect" href="using-jsr-330-standard-annotations.html">Using JSR 330 
standard annotations</a></td><td colspan="1" rowspan="1" 
class="ScrollbarNextIcon"><a shape="rect" href="using-jsr-330-standard
 -annotations.html"><img align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif"; width="16" 
height="16"></a></td></tr></table></div><div class="navmenu" 
style="float:right; background:#eee; margin:3px; padding:3px">
 <h3>Related Articles</h3>
 <ul class="content-by-label"><li>
             <div>
@@ -100,43 +99,7 @@ table.ScrollbarTable td.ScrollbarNextIco
                 
                             </div>
         </li></ul>
-</div> 
-
-<h1 id="LogginginTapestry-LogginginTapestry">Logging in Tapestry</h1>
-
-<p>Logging in Tapestry is based on the <a shape="rect" class="external-link" 
href="http://www.slf4j.org/"; >Simple Logging Facade for Java (SLF4J)</a>. You 
can think of SLF4J as a leaner, meaner replacement for <a shape="rect" 
class="external-link" 
href="http://commons.apache.org/logging/";>commons-logging</a>.</p>
-
-<p>In theory, SLF4J is a wrapper around any of a number of logging systems, 
including <a shape="rect" class="external-link" 
href="http://logging.apache.org/log4j/1.2/";>Log4J</a> or the built-in JDK 
logging. In practice, it is almost always used with Log4J and no additional 
build configuration is needed.</p>
-
-<p>Your application <em>will</em> need to provide a 
<strong>log4j.properties</strong> file (or its XML equivalent). See <a 
shape="rect" class="external-link" 
href="http://logging.apache.org/log4j/1.2/manual.html";>the Log4J manual</a> for 
more information.</p>
-
-<h1 id="LogginginTapestry-AccessingLoggers">Accessing Loggers</h1>
-
-<p>Loggers are a special kind of resource that is injected into a service. In 
Tapestry IoC, Loggers an be injected into service constructors, or into service 
builder methods.</p>
-
-<p>In Tapestry Core (the web framework), Loggers for components can be 
injected into component fields.</p>
-
-<p>This often confuses people, because the standard idiom is to create a 
Logger based on the class name and inject it into a static field. In Tapestry, 
the Logger is created on your code's behalf and provided to you, and stored 
into a final private field.</p>
-
-<p>In terms of separation of concerns, Tapestry's approach is superior ... the 
concern of creating loggers is offloaded into the framework, and you code 
retains the concern of actually logging useful information. However this is 
largely theoretical.</p>
-
-<p>For a pragmatic standpoint, injecting Loggers makes it easier to test 
<em>logging</em> code using the same techniques used to test other code: via 
the injection of Mock Object implementations of the Logger interface. This is 
something to consider when writing your own services, components and test.</p>
-
-<h1 id="LogginginTapestry-ServiceLogging">Service Logging</h1>
-
-<p>Tapestry uses the same loggers that are injected into services; it logs, at 
debug level, details about the construction of the service (and the proxy for 
the service), including details such as methods invoked. </p>
-
-<h1 id="LogginginTapestry-OperationTracker">Operation Tracker</h1>
-
-<p>The OperationTracker is a resource available throughout Tapestry that is 
used to track what Tapestry is doing at any given time. Normally, this 
information is only used when reporting errors, as it gives an indication of 
what Tapestry was doing leading up to the point where the exception 
occurred.</p>
-
-<p>Starting in Tapestry 5.3, you may also enable debug logging for 
<code>org.apache.tapestry5.ioc.Registry</code> to see voluminous details on 
creation of proxies, services, injections, and so forth. It also tracks 
creation of pages and components, triggering of component events, handling of 
return values from event handler methods, and many (many!) other details.</p>
-
-<p>The logging even identifies how long each operation takes. This can be 
useful for understanding what is going on in a Tapestry application during the 
processing of the request, it can also be useful when tracking down performance 
issues. </p>
-
-<p>An example from the startup of a Tapestry application:</p>
-
-<div class="preformatted panel" style="border-width: 1px;"><div 
class="preformattedContent panelContent">
+</div><h1 id="LogginginTapestry-LogginginTapestry">Logging in 
Tapestry</h1><p>Logging in Tapestry is based on the <a shape="rect" 
class="external-link" href="http://www.slf4j.org/"; >Simple Logging Facade for 
Java (SLF4J)</a>. You can think of SLF4J as a leaner, meaner replacement for <a 
shape="rect" class="external-link" 
href="http://commons.apache.org/logging/";>commons-logging</a>.</p><p>In theory, 
SLF4J is a wrapper around any of a number of logging systems, including <a 
shape="rect" class="external-link" 
href="http://logging.apache.org/log4j/1.2/";>Log4J</a> or the built-in JDK 
logging. In practice, it is almost always used with Log4J and no additional 
build configuration is needed.</p><p>Your application <em>will</em> need to 
provide a <strong>log4j.properties</strong> file (or its XML equivalent). See 
<a shape="rect" class="external-link" 
href="http://logging.apache.org/log4j/1.2/manual.html";>the Log4J manual</a> for 
more information.</p><h1 id="LogginginTapestry-AccessingLogger
 s">Accessing Loggers</h1><p>Loggers are a special kind of resource that is 
injected into a service. In Tapestry IoC, Loggers an be injected into service 
constructors, or into service builder methods.</p><p>In Tapestry Core (the web 
framework), Loggers for components can be injected into component 
fields.</p><p>This often confuses people, because the standard idiom is to 
create a Logger based on the class name and inject it into a static field. In 
Tapestry, the Logger is created on your code's behalf and provided to you, and 
stored into a final private field.</p><p>In terms of separation of concerns, 
Tapestry's approach is superior ... the concern of creating loggers is 
offloaded into the framework, and you code retains the concern of actually 
logging useful information. However this is largely theoretical.</p><p>For a 
pragmatic standpoint, injecting Loggers makes it easier to test 
<em>logging</em> code using the same techniques used to test other code: via 
the injection of Mock Obje
 ct implementations of the Logger interface. This is something to consider when 
writing your own services, components and test.</p><h1 
id="LogginginTapestry-ServiceLogging">Service Logging</h1><p>Tapestry uses the 
same loggers that are injected into services; it logs, at debug level, details 
about the construction of the service (and the proxy for the service), 
including details such as methods invoked.</p><h1 
id="LogginginTapestry-OperationTracker">Operation Tracker</h1><p>The 
OperationTracker is a resource available throughout Tapestry that is used to 
track what Tapestry is doing at any given time. Normally, this information is 
only used when reporting errors, as it gives an indication of what Tapestry was 
doing leading up to the point where the exception occurred.</p><p>Starting in 
Tapestry 5.3, you may also enable debug logging for 
<code>org.apache.tapestry5.ioc.Registry</code> to see voluminous details on 
creation of proxies, services, injections, and so forth. It also tracks cr
 eation of pages and components, triggering of component events, handling of 
return values from event handler methods, and many (many!) other 
details.</p><p>The logging even identifies how long each operation takes. This 
can be useful for understanding what is going on in a Tapestry application 
during the processing of the request, it can also be useful when tracking down 
performance issues.</p><p>An example from the startup of a Tapestry 
application:</p><div class="preformatted panel" style="border-width: 1px;"><div 
class="preformattedContent panelContent">
 <pre>[INFO] RegistryBuilder Adding module definition for class 
org.apache.tapestry5.services.TapestryModule
 [INFO] RegistryBuilder Adding module definition for class 
org.apache.tapestry5.internal.services.InternalModule
 [INFO] RegistryBuilder Adding module definition for class 
org.apache.tapestry5.services.assets.AssetsModule
@@ -182,17 +145,7 @@ table.ScrollbarTable td.ScrollbarNextIco
 [DEBUG] Registry [ 11] --&gt; Determining injection value for parameter #2 
(org.apache.tapestry5.ioc.ObjectProvider)
 . . .
 </pre>
-</div></div>
-
-<h1 
id="LogginginTapestry-ConfiguringTapestryforotherLoggingToolkits">Configuring 
Tapestry for other Logging Toolkits</h1>
-
-<p>The default configuration uses Log4J.</p>
-
-<p>If you need to use another logging system, that can be accomplished using 
Maven dependency control.</p>
-
-<p>You can exclude some of the dependencies that Tapestry introduces, and 
replace them with your own. For example, to switch over to JDK logging, update 
your pom as follows:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div><h1 
id="LogginginTapestry-ConfiguringTapestryforotherLoggingToolkits">Configuring 
Tapestry for other Logging Toolkits</h1><p>The default configuration uses 
Log4J.</p><p>If you need to use another logging system, that can be 
accomplished using Maven dependency control.</p><p>You can exclude some of the 
dependencies that Tapestry introduces, and replace them with your own. For 
example, to switch over to JDK logging, update your pom as follows:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[ 
   &lt;dependencies&gt;
     &lt;dependency&gt;
@@ -221,13 +174,7 @@ table.ScrollbarTable td.ScrollbarNextIco
     &lt;/dependency&gt;
   &lt;/dependencies&gt;
 ]]></script>
-</div></div>
-
-<p>This pulls out the log4j support normally included with Tapestry, and 
replaces it with the SLF4J library that wraps around JDK 1.4 logging.</p>
-
-<p>In all likelihood, you'll replace <em>tapestry-ioc</em> with 
<em>tapestry-core</em> (assuming you are building a web application using 
Tapestry, rather than using Tapestry IoC as part of some other application). 
And, of course, version numbers change all the time!</p>
-
-<style type="text/css">/*<![CDATA[*/
+</div></div><p>This pulls out the log4j support normally included with 
Tapestry, and replaces it with the SLF4J library that wraps around JDK 1.4 
logging.</p><p>In all likelihood, you'll replace <em>tapestry-ioc</em> with 
<em>tapestry-core</em> (assuming you are building a web application using 
Tapestry, rather than using Tapestry IoC as part of some other application). 
And, of course, version numbers change all the time!</p><style 
type="text/css">/*<![CDATA[*/
 table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 
3px;margin: 0px;background-color: #f0f0f0}
 table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 
16px;border: none;}
 table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}

Modified: 
websites/production/tapestry/content/overriding-exception-reporting.html
==============================================================================
--- websites/production/tapestry/content/overriding-exception-reporting.html 
(original)
+++ websites/production/tapestry/content/overriding-exception-reporting.html 
Sat Jan 18 18:21:05 2014
@@ -29,6 +29,7 @@
   <link 
href='http://cxf.apache.org/resources/highlighter/styles/shThemeCXF.css' 
rel='stylesheet' type='text/css' />
   <script src='http://cxf.apache.org/resources/highlighter/scripts/shCore.js' 
type='text/javascript'></script>
   <script 
src='http://cxf.apache.org/resources/highlighter/scripts/shBrushJava.js' 
type='text/javascript'></script>
+  <script 
src='http://cxf.apache.org/resources/highlighter/scripts/shBrushXml.js' 
type='text/javascript'></script>
   <script type="text/javascript">
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -77,19 +78,14 @@ table.ScrollbarTable td.ScrollbarParent 
 table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
 table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 
16px;border: none;}
 
-/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td 
colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" 
href="default-parameter.html"><img align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/back_16.gif"; width="16" 
height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" 
width="33%"><a shape="rect" href="default-parameter.html">Default 
Parameter</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" 
width="33%"><sup><a shape="rect" href="cookbook.html"><img align="middle" 
border="0" src="https://cwiki.apache.org/confluence/images/icons/up_16.gif"; 
width="8" height="8"></a></sup><a shape="rect" 
href="cookbook.html">Cookbook</a></td><td colspan="1" rowspan="1" 
class="ScrollbarNextName" width="33%">&#160;<a shape="rect" 
href="supporting-informal-parameters.html">Supporting Informal 
Parameters</a></td><td colspan="1" rowspan="1" class="ScrollbarNextIcon"><a 
shape="rect" href="supporting-informa
 l-parameters.html"><img align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif"; width="16" 
height="16"></a></td></tr></table></div>
-<p></p>
-
-<h1 id="OverridingExceptionReporting-OverridingExceptionReporting">Overriding 
Exception Reporting</h1>
-
-<div class="navmenu" style="float:right; background:#eee; margin:3px; 
padding:3px">
+/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td 
colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" 
href="default-parameter.html"><img align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/back_16.gif"; width="16" 
height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" 
width="33%"><a shape="rect" href="default-parameter.html">Default 
Parameter</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" 
width="33%"><sup><a shape="rect" href="cookbook.html"><img align="middle" 
border="0" src="https://cwiki.apache.org/confluence/images/icons/up_16.gif"; 
width="8" height="8"></a></sup><a shape="rect" 
href="cookbook.html">Cookbook</a></td><td colspan="1" rowspan="1" 
class="ScrollbarNextName" width="33%">&#160;<a shape="rect" 
href="supporting-informal-parameters.html">Supporting Informal 
Parameters</a></td><td colspan="1" rowspan="1" class="ScrollbarNextIcon"><a 
shape="rect" href="supporting-informa
 l-parameters.html"><img align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif"; width="16" 
height="16"></a></td></tr></table></div><h1 
id="OverridingExceptionReporting-OverridingExceptionReporting">Overriding 
Exception Reporting</h1><div class="navmenu" style="float:right; 
background:#eee; margin:3px; padding:3px">
 <h3>Related Articles</h3>
 <ul class="content-by-label"><li>
             <div>
                     <span class="icon icon-page" title="Page">Page:</span>     
       </div>
 
             <div class="details">
-                            <a shape="rect" 
href="overriding-exception-reporting.html">Overriding Exception Reporting</a>
+                            <a shape="rect" 
href="error-page-recipe.html">Error Page Recipe</a>
                     
                 
                             </div>
@@ -98,7 +94,7 @@ table.ScrollbarTable td.ScrollbarNextIco
                     <span class="icon icon-page" title="Page">Page:</span>     
       </div>
 
             <div class="details">
-                            <a shape="rect" 
href="error-page-recipe.html">Error Page Recipe</a>
+                            <a shape="rect" 
href="specific-errors-faq.html">Specific Errors FAQ</a>
                     
                 
                             </div>
@@ -107,24 +103,13 @@ table.ScrollbarTable td.ScrollbarNextIco
                     <span class="icon icon-page" title="Page">Page:</span>     
       </div>
 
             <div class="details">
-                            <a shape="rect" 
href="specific-errors-faq.html">Specific Errors FAQ</a>
+                            <a shape="rect" 
href="overriding-exception-reporting.html">Overriding Exception Reporting</a>
                     
                 
                             </div>
         </li></ul>
-</div>
-
-<p>One of Tapestry's best features is its comprehensive exception reporting. 
The level of detail is impressive and useful.</p>
-
-<p>Of course, one of the first questions anyone asks is "How do I turn it 
off?" This exception reporting is very helpful for developers but its easy to 
see it as terrifying for potential users. Not that you'd have have runtime 
exceptions in production, of course, but even so ...</p>
-
-<h2 
id="OverridingExceptionReporting-Version1:ReplacingtheExceptionReportPage">Version
 1: Replacing the Exception Report Page</h2>
-
-<p>Let's start with a page that fires an exception from an event handler 
method.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>Index.tml</b></div><div 
class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-&lt;html 
xmlns:t=&quot;http://tapestry.apache.org/schema/tapestry_5_1_0.xsd&quot;&gt;
+</div><p>One of Tapestry's best features is its comprehensive exception 
reporting. The level of detail is impressive and useful.</p><p>Of course, one 
of the first questions anyone asks is "How do I turn it off?" This exception 
reporting is very helpful for developers but its easy to see it as terrifying 
for potential users. Not that you'd have have runtime exceptions in production, 
of course, but even so ...</p><h2 
id="OverridingExceptionReporting-Version1:ReplacingtheExceptionReportPage">Version
 1: Replacing the Exception Report Page</h2><p>Let's start with a page that 
fires an exception from an event handler method.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>Index.tml</b></div><div class="codeContent 
panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[&lt;html 
xmlns:t=&quot;http://tapestry.apache.org/schema/tapestry_5_1_0.xsd&quot;&gt;
     &lt;head&gt;
         &lt;title&gt;Index&lt;/title&gt;
     &lt;/head&gt;
@@ -135,11 +120,8 @@ table.ScrollbarTable td.ScrollbarNextIco
     &lt;/body&gt;
 &lt;/html&gt;
 ]]></script>
-</div></div>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>Index.java</b></div><div 
class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-package com.example.tapestry2523.pages;
+</div></div><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>Index.java</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[package com.example.tapestry2523.pages;
 
 public class Index
 {
@@ -149,19 +131,8 @@ public class Index
     }
 }
 ]]></script>
-</div></div>
-
-<p>With production mode disabled, clicking the link displays the default 
exception report page:</p>
-
-<p><img class="confluence-embedded-image" 
src="https://cwiki.apache.org/confluence/download/attachments/20645557/error1.png?version=1&amp;modificationDate=1273638562000&amp;api=v2";
 
data-image-src="/confluence/download/attachments/20645557/error1.png?version=1&amp;modificationDate=1273638562000&amp;api=v2"
 title="Default exception report"></p>
-
-<p>The easy way to override the exception report is to provide an 
ExceptionReport page that overrides the one provided with the framework.</p>
-
-<p>This is as easy as providing a page named "ExceptionReport". It must 
implement the <a shape="rect" class="external-link" 
href="http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/ExceptionReporter.html";>ExceptionReporter</a>
 interface.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 
1px;"><b>ExceptionReport.tml</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-&lt;html 
xmlns:t=&quot;http://tapestry.apache.org/schema/tapestry_5_1_0.xsd&quot;&gt;
+</div></div><p>With production mode disabled, clicking the link displays the 
default exception report page:</p><p><img class="confluence-embedded-image" 
src="https://cwiki.apache.org/confluence/download/attachments/20645557/error1.png?version=1&amp;modificationDate=1273638562000&amp;api=v2";
 
data-image-src="/confluence/download/attachments/20645557/error1.png?version=1&amp;modificationDate=1273638562000&amp;api=v2"
 title="Default exception report"></p><p>The easy way to override the exception 
report is to provide an ExceptionReport page that overrides the one provided 
with the framework.</p><p>This is as easy as providing a page named 
"ExceptionReport". It must implement the <a shape="rect" class="external-link" 
href="http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/ExceptionReporter.html";>ExceptionReporter</a>
 interface.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Exc
 eptionReport.tml</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[&lt;html 
xmlns:t=&quot;http://tapestry.apache.org/schema/tapestry_5_1_0.xsd&quot;&gt;
     &lt;head&gt;
         &lt;title&gt;Exception&lt;/title&gt;
     &lt;/head&gt;
@@ -182,11 +153,8 @@ public class Index
 
 &lt;/html&gt;
 ]]></script>
-</div></div>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 
1px;"><b>ExceptionReport.java</b></div><div class="codeContent panelContent 
pdl">
-<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-package com.example.tapestry2523.pages;
+</div></div><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>ExceptionReport.java</b></div><div class="codeContent panelContent 
pdl">
+<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[package com.example.tapestry2523.pages;
 
 import org.apache.tapestry5.annotations.Property;
 import org.apache.tapestry5.services.ExceptionReporter;
@@ -202,37 +170,16 @@ public class ExceptionReport implements 
     }
 }
 ]]></script>
-</div></div>
-
-<p>The end result is a customized exception report page.</p>
-
-<p><img class="confluence-embedded-image" 
src="https://cwiki.apache.org/confluence/download/attachments/20645557/error2.png?version=1&amp;modificationDate=1273638562000&amp;api=v2";
 
data-image-src="/confluence/download/attachments/20645557/error2.png?version=1&amp;modificationDate=1273638562000&amp;api=v2"
 title="Customized Exception Report Page"></p>
-
-
-<h2 
id="OverridingExceptionReporting-Version2:OverridingtheRequestExceptionHandler">Version
 2: Overriding the RequestExceptionHandler</h2>
-
-<p>The previous example will display a link back to the Index page of the 
application. Another alternative is to display the error &lt;on&gt; the Index 
page.  This requires a different approach: overriding the service responsible 
for reporting request exceptions.</p>
-
-<p>The service <a shape="rect" class="external-link" 
href="http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/RequestExceptionHandler.html";>RequestExceptionHandler</a>
 is responsible for this.</p>
-
-<p>By replacing the default implementation of this service with our own 
implementation, we can take control over exactly what happens when a request 
exception occurs.</p>
-
-<p>We'll do this in two steps. First, we'll extend the Index page to serve as 
an ExceptionReporter. Second, we'll override the default 
RequestExceptionHandler to use the Index page instead of the ExceptionReport 
page. Of course, this is just one approach.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>Index.tml 
(partial)</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-    &lt;t:if test=&quot;message&quot;&gt;
+</div></div><p>The end result is a customized exception report 
page.</p><p><img class="confluence-embedded-image" 
src="https://cwiki.apache.org/confluence/download/attachments/20645557/error2.png?version=1&amp;modificationDate=1273638562000&amp;api=v2";
 
data-image-src="/confluence/download/attachments/20645557/error2.png?version=1&amp;modificationDate=1273638562000&amp;api=v2"
 title="Customized Exception Report Page"></p><h2 
id="OverridingExceptionReporting-Version2:OverridingtheRequestExceptionHandler">Version
 2: Overriding the RequestExceptionHandler</h2><p>The previous example will 
display a link back to the Index page of the application. Another alternative 
is to display the error &lt;on&gt; the Index page. This requires a different 
approach: overriding the service responsible for reporting request 
exceptions.</p><p>The service <a shape="rect" class="external-link" 
href="http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/RequestExceptionHandler.html";>Reque
 stExceptionHandler</a> is responsible for this.</p><p>By replacing the default 
implementation of this service with our own implementation, we can take control 
over exactly what happens when a request exception occurs.</p><p>We'll do this 
in two steps. First, we'll extend the Index page to serve as an 
ExceptionReporter. Second, we'll override the default RequestExceptionHandler 
to use the Index page instead of the ExceptionReport page. Of course, this is 
just one approach.</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>Index.tml (partial)</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[    &lt;t:if test=&quot;message&quot;&gt;
         &lt;p&gt;
             An unexpected exception has occurred:
             &lt;strong&gt;${message}&lt;/strong&gt;
         &lt;/p&gt;
     &lt;/t:if&gt;
 ]]></script>
-</div></div>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 1px;"><b>Index.java</b></div><div 
class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-public class Index implements ExceptionReporter
+</div></div><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>Index.java</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[public class Index implements 
ExceptionReporter
 {
     @Property
     @Persist(PersistenceConstants.FLASH)
@@ -249,17 +196,8 @@ public class Index implements ExceptionR
     }
 }
 ]]></script>
-</div></div>
-
-<p>The above defines a new property, message, on the Index page. The @Persist 
annotation indicates that values assigned to the field will persist from one 
request to another. The use of FLASH for the persistence strategy indicates 
that the value will be used until the next time the page renders, then the 
value will be discarded.</p>
-
-<p>The message property is set from the thrown runtime exception.</p>
-
-<p>The remaining changes take place inside AppModule.</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">
-<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-    public RequestExceptionHandler buildAppRequestExceptionHandler(
+</div></div><p>The above defines a new property, message, on the Index page. 
The @Persist annotation indicates that values assigned to the field will 
persist from one request to another. The use of FLASH for the persistence 
strategy indicates that the value will be used until the next time the page 
renders, then the value will be discarded.</p><p>The message property is set 
from the thrown runtime exception.</p><p>The remaining changes take place 
inside AppModule.</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">
+<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[    public RequestExceptionHandler 
buildAppRequestExceptionHandler(
             final Logger logger,
             final ResponseRenderer renderer,
             final ComponentSource componentSource)
@@ -288,33 +226,8 @@ public class Index implements ExceptionR
         configuration.add(RequestExceptionHandler.class, handler);
     }
 ]]></script>
-</div></div>
-
-<p>First we define the new service using a service builder method. This is an 
alternative to the <code>bind()</code> method; we define the service, its 
interface type (the return type of the method) and the service id (the part 
that follows "build" is the method name) and provide the implementation inline. 
A service builder method must return the service implementation, here 
implemented as an inner class.</p>
-
-<p>The Logger resource that is passed into the builder method is the Logger 
appropriate for the service. ResponseRenderer and ComponentSource are two 
services defined by Tapestry.</p>
-
-<p>With this in place, there are now two different services that implement the 
RequestExceptionHandler interface: the default one built into Tapestry (whose 
service id is "RequestExceptionHandler") and the new one defined in this 
module, "AppRequestExceptionHandler").  Without a little more work, Tapestry 
will be unable to determine which one to use when an exception does occur.</p>
-
-<p>Tapestry has a pipeline for resolving injected dependencies; the 
ServiceOverride service is one part of that pipeline. Contributions to it are 
used to override an existing service, when the injection is exclusively by 
type. </p>
-
-<p>Here we inject the AppRequestExceptionHandler service and contribute it as 
the override for type RequestExceptionHandler. The @Local annotation is used to 
select the RequestHandler service defined by this module, AppModule. Once 
contributed into ServiceOverride, it becomes the default service injected 
throughout the Registry.</p>
-
-<p>This finally brings us to the point where we can see the result:</p>
-
-<p><img class="confluence-embedded-image" 
src="https://cwiki.apache.org/confluence/download/attachments/20645557/error3.png?version=1&amp;modificationDate=1273638562000&amp;api=v2";
 
data-image-src="/confluence/download/attachments/20645557/error3.png?version=1&amp;modificationDate=1273638562000&amp;api=v2"
 title="Errors show on Index page"></p>
-
-<h2 
id="OverridingExceptionReporting-Version3:DecoratingtheRequestExceptionHandler">Version
 3: Decorating the RequestExceptionHandler</h2>
-
-<p>A third option is available: we don't define a <em>new</em> service, but 
instead <em>decorate</em> the existing RequestExceptionHandler service. This 
approach means we don't have to make a contribution to the ServiceOverride 
service.</p>
-
-<p>Service decoration is a powerful facility of Tapestry that is generally 
used to "wrap" an existing service with an interceptor that provides new 
functionality such as logging, security, transaction management or other 
cross-cutting concerns. The interceptor is an object that implements the same 
interface as the service being decorated, and usually delegates method 
invocations to it.</p>
-
-<p>However, there's no requirement that an interceptor for a service actually 
invoke methods on the service; here we contribute a new implementation that 
<em>replaces</em> the original:</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">
-<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-    public RequestExceptionHandler decorateRequestExceptionHandler(
+</div></div><p>First we define the new service using a service builder method. 
This is an alternative to the <code>bind()</code> method; we define the 
service, its interface type (the return type of the method) and the service id 
(the part that follows "build" is the method name) and provide the 
implementation inline. A service builder method must return the service 
implementation, here implemented as an inner class.</p><p>The Logger resource 
that is passed into the builder method is the Logger appropriate for the 
service. ResponseRenderer and ComponentSource are two services defined by 
Tapestry.</p><p>With this in place, there are now two different services that 
implement the RequestExceptionHandler interface: the default one built into 
Tapestry (whose service id is "RequestExceptionHandler") and the new one 
defined in this module, "AppRequestExceptionHandler"). Without a little more 
work, Tapestry will be unable to determine which one to use when an exception 
does occur.</p><p>Tap
 estry has a pipeline for resolving injected dependencies; the ServiceOverride 
service is one part of that pipeline. Contributions to it are used to override 
an existing service, when the injection is exclusively by type.</p><p>Here we 
inject the AppRequestExceptionHandler service and contribute it as the override 
for type RequestExceptionHandler. The @Local annotation is used to select the 
RequestHandler service defined by this module, AppModule. Once contributed into 
ServiceOverride, it becomes the default service injected throughout the 
Registry.</p><p>This finally brings us to the point where we can see the 
result:</p><p><img class="confluence-embedded-image" 
src="https://cwiki.apache.org/confluence/download/attachments/20645557/error3.png?version=1&amp;modificationDate=1273638562000&amp;api=v2";
 
data-image-src="/confluence/download/attachments/20645557/error3.png?version=1&amp;modificationDate=1273638562000&amp;api=v2"
 title="Errors show on Index page"></p><h2 id="OverridingExcep
 tionReporting-Version3:DecoratingtheRequestExceptionHandler">Version 3: 
Decorating the RequestExceptionHandler</h2><p>A third option is available: we 
don't define a <em>new</em> service, but instead <em>decorate</em> the existing 
RequestExceptionHandler service. This approach means we don't have to make a 
contribution to the ServiceOverride service.</p><p>Service decoration is a 
powerful facility of Tapestry that is generally used to "wrap" an existing 
service with an interceptor that provides new functionality such as logging, 
security, transaction management or other cross-cutting concerns. The 
interceptor is an object that implements the same interface as the service 
being decorated, and usually delegates method invocations to it.</p><p>However, 
there's no requirement that an interceptor for a service actually invoke 
methods on the service; here we contribute a new implementation that 
<em>replaces</em> the original:</p><div class="code panel pdl" 
style="border-width: 1px;"><div c
 lass="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>AppModule.java (partial)</b></div><div class="codeContent panelContent 
pdl">
+<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[    public RequestExceptionHandler 
decorateRequestExceptionHandler(
             final Logger logger,
             final ResponseRenderer renderer,
             final ComponentSource componentSource,
@@ -339,17 +252,7 @@ public class Index implements ExceptionR
         };
     }
 ]]></script>
-</div></div>
-
-<p>As with service builder methods and service configuration method, decorator 
methods are recognized by the "decorate" prefix on the method name. As used 
here, the rest of the method name is used to identify the service to be 
decorated (there are other options that allow a decorator to be applied to many 
different services).</p>
-
-<p>A change in this version is that when in development mode (that is, when 
<em>not</em> in production mode) we use the normal implementation.  Returning 
null from a service decoration method indicates that the decorator chooses not 
to decorate.</p>
-
-<p>The Logger injected here is the Logger for the service being decorated, the 
default RequestExceptionHandler service.</p>
-
-<p>Otherwise, we return an interceptor whose implementation is the same as the 
new service in version #2.</p>
-
-<p>The end result is that in development mode we get the full exception 
report, and in production mode we get an abbreviated message on the 
application's Index page.</p></div>
+</div></div><p>As with service builder methods and service configuration 
method, decorator methods are recognized by the "decorate" prefix on the method 
name. As used here, the rest of the method name is used to identify the service 
to be decorated (there are other options that allow a decorator to be applied 
to many different services).</p><p>A change in this version is that when in 
development mode (that is, when <em>not</em> in production mode) we use the 
normal implementation. Returning null from a service decoration method 
indicates that the decorator chooses not to decorate.</p><p>The Logger injected 
here is the Logger for the service being decorated, the default 
RequestExceptionHandler service.</p><p>Otherwise, we return an interceptor 
whose implementation is the same as the new service in version #2.</p><p>The 
end result is that in development mode we get the full exception report, and in 
production mode we get an abbreviated message on the application's Index 
page.</p></div
 >
 </div>
 
 <div class="clearer"></div>

Modified: websites/production/tapestry/content/security.html
==============================================================================
--- websites/production/tapestry/content/security.html (original)
+++ websites/production/tapestry/content/security.html Sat Jan 18 18:21:05 2014
@@ -61,16 +61,14 @@
   </div>
 
 <div id="content">
-<div id="ConfluenceContent"><p>Tapestry does not come with a built-in security 
implementation to avoid lock-in to a specific security framework. There are 
various Java security frameworks available, but the main two Java-based open 
source security frameworks are Apache Shiro (earlier JSecurity) and Spring 
Security (earlier Acegi Security). Spring Security is the more popular of the 
two (because of Spring's popularity), whereas Shiro is widely regarded as the 
more flexible choice. There are well-maintained Tapestry integration projects 
for both of these frameworks, <strong><a shape="rect" class="external-link" 
href="http://tynamo.org/tapestry-security+guide"; 
>tapestry-security</a></strong> for Apache Shiro (from Tynamo.org) and 
<strong><a shape="rect" class="external-link" 
href="http://www.localhost.nu/java/tapestry-spring-security"; 
>tapestry-spring-security</a></strong> for Spring Security.</p>
-
-<div class="navmenu" style="float:right; background:#eee; margin:3px; 
padding:3px">
+<div id="ConfluenceContent"><p>Tapestry does not come with a built-in security 
implementation to avoid lock-in to a specific security framework. There are 
various Java security frameworks available, but the main two Java-based open 
source security frameworks are Apache Shiro (earlier JSecurity) and Spring 
Security (earlier Acegi Security). Spring Security is the more popular of the 
two (because of Spring's popularity), whereas Shiro is widely regarded as the 
more flexible choice. There are well-maintained Tapestry integration projects 
for both of these frameworks, <strong><a shape="rect" class="external-link" 
href="http://tynamo.org/tapestry-security+guide"; 
>tapestry-security</a></strong> for Apache Shiro (from Tynamo.org) and 
<strong><a shape="rect" class="external-link" 
href="http://www.localhost.nu/java/tapestry-spring-security"; 
>tapestry-spring-security</a></strong> for Spring Security.</p><div 
class="navmenu" style="float:right; background:#eee; margin:3px; padding:3px">
 <h3>Related Articles</h3>
 <ul class="content-by-label"><li>
             <div>
                     <span class="icon icon-page" title="Page">Page:</span>     
       </div>
 
             <div class="details">
-                            <a shape="rect" 
href="integrating-with-spring-framework.html">Integrating with Spring 
Framework</a>
+                            <a shape="rect" href="security.html">Security</a>
                     
                 
                             </div>
@@ -79,27 +77,21 @@
                     <span class="icon icon-page" title="Page">Page:</span>     
       </div>
 
             <div class="details">
-                            <a shape="rect" href="security.html">Security</a>
+                            <a shape="rect" href="https.html">HTTPS</a>
                     
                 
                             </div>
-        </li></ul>
-</div>
-
-<p>For tapestry-security (Shiro-based)</p>
-
-<ul><li><a shape="rect" class="external-link" 
href="http://tynamo.org/tynamo-federatedaccounts+guide"; 
>Tynamo-federatedaccounts</a> Facebook etc. 3rd party authentication provider 
integrations, building on Tapestry-security</li></ul>
-
-
-<p>For tapestry-spring-security</p>
-
-<ul><li><a shape="rect" class="external-link" 
href="http://www.localhost.nu/java/tapestry-spring-security/conf.html"; 
>http://www.localhost.nu/java/tapestry-spring-security/conf.html</a></li></ul>
-
-
-<p>To include OpenID with Spring Security in your application, see the 
following Wiki entry:</p>
+        </li><li>
+            <div>
+                    <span class="icon icon-page" title="Page">Page:</span>     
       </div>
 
-<ul><li><a shape="rect" class="external-link" 
href="http://wiki.apache.org/tapestry/Tapestry5HowToSpringSecurityAndOpenId";>http://wiki.apache.org/tapestry/Tapestry5HowToSpringSecurityAndOpenId</a></li></ul>
-</div>
+            <div class="details">
+                            <a shape="rect" 
href="integrating-with-spring-framework.html">Integrating with Spring 
Framework</a>
+                    
+                
+                            </div>
+        </li></ul>
+</div><p>For tapestry-security (Shiro-based)</p><ul><li><a shape="rect" 
class="external-link" href="http://tynamo.org/tynamo-federatedaccounts+guide"; 
>Tynamo-federatedaccounts</a> Facebook etc. 3rd party authentication provider 
integrations, building on Tapestry-security</li></ul><p>For 
tapestry-spring-security</p><ul><li><a shape="rect" class="external-link" 
href="http://www.localhost.nu/java/tapestry-spring-security/conf.html"; 
>http://www.localhost.nu/java/tapestry-spring-security/conf.html</a></li></ul><p>To
 include OpenID with Spring Security in your application, see the following 
Wiki entry:</p><ul><li><a shape="rect" class="external-link" 
href="http://wiki.apache.org/tapestry/Tapestry5HowToSpringSecurityAndOpenId";>http://wiki.apache.org/tapestry/Tapestry5HowToSpringSecurityAndOpenId</a></li></ul></div>
 </div>
 
 <div class="clearer"></div>

Modified: websites/production/tapestry/content/switching-cases.html
==============================================================================
--- websites/production/tapestry/content/switching-cases.html (original)
+++ websites/production/tapestry/content/switching-cases.html Sat Jan 18 
18:21:05 2014
@@ -29,6 +29,7 @@
   <link 
href='http://cxf.apache.org/resources/highlighter/styles/shThemeCXF.css' 
rel='stylesheet' type='text/css' />
   <script src='http://cxf.apache.org/resources/highlighter/scripts/shCore.js' 
type='text/javascript'></script>
   <script 
src='http://cxf.apache.org/resources/highlighter/scripts/shBrushJava.js' 
type='text/javascript'></script>
+  <script 
src='http://cxf.apache.org/resources/highlighter/scripts/shBrushXml.js' 
type='text/javascript'></script>
   <script type="text/javascript">
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -77,24 +78,10 @@ table.ScrollbarTable td.ScrollbarParent 
 table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
 table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 
16px;border: none;}
 
-/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td 
colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" 
href="component-libraries.html"><img align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/back_16.gif"; width="16" 
height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" 
width="33%"><a shape="rect" href="component-libraries.html">Component 
Libraries</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" 
width="33%"><sup><a shape="rect" href="cookbook.html"><img align="middle" 
border="0" src="https://cwiki.apache.org/confluence/images/icons/up_16.gif"; 
width="8" height="8"></a></sup><a shape="rect" 
href="cookbook.html">Cookbook</a></td><td colspan="1" rowspan="1" 
class="ScrollbarNextName" width="33%">&#160;<a shape="rect" 
href="enum-parameter-recipe.html">Enum Parameter Recipe</a></td><td colspan="1" 
rowspan="1" class="ScrollbarNextIcon"><a shape="rect" 
href="enum-parameter-recipe.html"><i
 mg align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif"; width="16" 
height="16"></a></td></tr></table></div>
-<p></p>
-
-<h1 id="SwitchingCases-SwitchingCases">Switching Cases</h1>
-
-<p>With Tapestry's <code>If</code> component you can only test one condition 
at a time. In order to distinguish multiple cases, you'd have to write complex 
nested if/else constructs in your page template and have a checker method for 
each test inside your page class.</p>
-
-<div class="navmenu" style="float:right; background:#eee; margin:3px; 
padding:0 1em">
+/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td 
colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" 
href="component-libraries.html"><img align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/back_16.gif"; width="16" 
height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" 
width="33%"><a shape="rect" href="component-libraries.html">Component 
Libraries</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" 
width="33%"><sup><a shape="rect" href="cookbook.html"><img align="middle" 
border="0" src="https://cwiki.apache.org/confluence/images/icons/up_16.gif"; 
width="8" height="8"></a></sup><a shape="rect" 
href="cookbook.html">Cookbook</a></td><td colspan="1" rowspan="1" 
class="ScrollbarNextName" width="33%">&#160;<a shape="rect" 
href="enum-parameter-recipe.html">Enum Parameter Recipe</a></td><td colspan="1" 
rowspan="1" class="ScrollbarNextIcon"><a shape="rect" 
href="enum-parameter-recipe.html"><i
 mg align="middle" border="0" 
src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif"; width="16" 
height="16"></a></td></tr></table></div><h1 
id="SwitchingCases-SwitchingCases">Switching Cases</h1><p>With Tapestry's 
<code>If</code> component you can only test one condition at a time. In order 
to distinguish multiple cases, you'd have to write complex nested if/else 
constructs in your page template and have a checker method for each test inside 
your page class.</p><div class="navmenu" style="float:right; background:#eee; 
margin:3px; padding:0 1em">
 <p>    <strong>JumpStart Demo:</strong><br clear="none">
-    <a shape="rect" class="external-link" 
href="http://jumpstart.doublenegative.com.au/jumpstart/examples/lang/ifnotnegateswitchelseunless";
 >If, Not, Negate, Switch, Else, Unless</a></p></div>
-
-<p>In cases where you have to distinguish multiple cases, the 
<code>Delegate</code> component comes in. It delegates rendering to some other 
component, for example a <code>Block</code>. For each case you have, you 
basically wrap the content inside a <code>Block</code> that doesn't get 
rendered by default. You then place a Delegate component on your page and point 
it to a method inside your page class that will decide which of your Blocks 
should be rendered.</p>
-
-<p>Imagine for example a use case, where you want to distinguish between 4 
cases and you have an int property called <code>whichCase</code> that should be 
tested against. Your page template would look as follows:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 
1px;"><b>SwitchMe.tml</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-&lt;html 
xmlns:t=&quot;http://tapestry.apache.org/schema/tapestry_5_1_0.xsd&quot;&gt;
+    <a shape="rect" class="external-link" 
href="http://jumpstart.doublenegative.com.au/jumpstart/examples/lang/ifnotnegateswitchelseunless";
 >If, Not, Negate, Switch, Else, Unless</a></p></div><p>In cases where you have 
to distinguish multiple cases, the <code>Delegate</code> component comes in. It 
delegates rendering to some other component, for example a <code>Block</code>. 
For each case you have, you basically wrap the content inside a 
<code>Block</code> that doesn't get rendered by default. You then place a 
Delegate component on your page and point it to a method inside your page class 
that will decide which of your Blocks should be rendered.</p><p>Imagine for 
example a use case, where you want to distinguish between 4 cases and you have 
an int property called <code>whichCase</code> that should be tested against. 
Your page template would look as follows:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1
 px;"><b>SwitchMe.tml</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[&lt;html 
xmlns:t=&quot;http://tapestry.apache.org/schema/tapestry_5_1_0.xsd&quot;&gt;
     &lt;body&gt;
         &lt;h1&gt;Switch&lt;/h1&gt;
 
@@ -118,13 +105,8 @@ table.ScrollbarTable td.ScrollbarNextIco
     &lt;/body&gt;
 &lt;/html&gt;
 ]]></script>
-</div></div>
-
-<p>You can see, that the <code>Delegate</code> component's <code>to</code> 
parameter is bound to the case property of your page class. In your page class 
you therefore have a <code>getCase()</code> method that is responsible for 
telling the <code>Delegate</code> component which component should be rendered. 
For that we are injecting references to the <code>Block}}s defined in your page 
template into the page class and return the according {{Block</code> in the 
<code>getCase()</code> method.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader 
panelHeader pdl" style="border-bottom-width: 
1px;"><b>SwitchMe.java</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-public class SwitchMe
+</div></div><p>You can see, that the <code>Delegate</code> component's 
<code>to</code> parameter is bound to the case property of your page class. In 
your page class you therefore have a <code>getCase()</code> method that is 
responsible for telling the <code>Delegate</code> component which component 
should be rendered. For that we are injecting references to the <code>Block}}s 
defined in your page template into the page class and return the according 
{{Block</code> in the <code>getCase()</code> method.</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
style="border-bottom-width: 1px;"><b>SwitchMe.java</b></div><div 
class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[public class SwitchMe
 {
     @Persist
     private int whichCase;
@@ -150,9 +132,7 @@ public class SwitchMe
     }
 }
 ]]></script>
-</div></div>
-
-<p>Happy switching!</p></div>
+</div></div><p>Happy switching!</p></div>
 </div>
 
 <div class="clearer"></div>


Reply via email to