Author: buildbot
Date: Sat Apr 21 20:20:05 2018
New Revision: 1028750

Log:
Production update by buildbot for tapestry

Modified:
    websites/production/tapestry/content/cache/main.pageCache
    websites/production/tapestry/content/runtime-exceptions.html

Modified: websites/production/tapestry/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/tapestry/content/runtime-exceptions.html
==============================================================================
--- websites/production/tapestry/content/runtime-exceptions.html (original)
+++ websites/production/tapestry/content/runtime-exceptions.html Sat Apr 21 
20:20:05 2018
@@ -75,13 +75,75 @@
       </div>
 
       <div id="content">
-                <div id="ConfluenceContent"><p>Feedback is vitally important 
when developing an application, and that is one of the areas where Tapestry has 
always excelled.</p><p>Especially during development, requests can fail. There 
can be errors in templates, broken code in your application, or something 
unexpected.</p><p>Tapestry has a built-in exception report page that captures 
an amazing wealth of information:</p><p><span 
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img 
class="confluence-embedded-image confluence-content-image-border" width="500" 
src="runtime-exceptions.data/Exception_Stack_Trace.png"></span></p><p><span 
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img 
class="confluence-embedded-image confluence-content-image-border" width="500" 
src="runtime-exceptions.data/Exception_Request.png"></span></p><p><span 
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img 
class="confluence-embedde
 d-image confluence-content-image-border" height="443" width="500" 
src="runtime-exceptions.data/Application_Exception.png"></span></p><p>This 
exception report features:</p><ul><li>The full stack of exceptions, top to 
bottom.</li><li>All non-null properties of each exception.</li><li>The stack 
trace&#160;<em>at the deepest 
level</em>.</li><li>Key&#160;<strong>request</strong> properties, header, 
attributes, and 
parameters.</li><li>Key&#160;<strong>session</strong><em>&#160;</em>propertes</li><li>A
 break down of the&#160;<em>thread</em> in your application</li><li>A listing 
of all JVM System properties<br clear="none"><br clear="none"></li></ul><p>In 
addition, Tapestry will write a text file for the exception with a similar 
level of detail. The default location for the exception files is a relative 
directory <em>build/exceptions</em>. You can configure the location by setting 
<a  class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/SymbolConstants
 
.html#EXCEPTION_REPORTS_DIR">SymbolConstants.EXCEPTION_REPORTS_DIR</a>.</p><p>This
 exception report is also built-in to Tapestry's Ajax support. When an Ajax 
request fails, Tapestry's client-side code will create an &lt;iframe&gt; to 
present this same information:</p><p><span 
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img 
class="confluence-embedded-image confluence-content-image-border" height="359" 
width="500" src="runtime-exceptions.data/Exception_Ajax.png"></span></p><p>In 
production, you may want to <a  
href="overriding-exception-reporting.html">override the exception report 
page</a> (but will likely keep the text file output). However, Tapestry's (from 
version 5.4) default exception reporter also allows you to handle specific 
exception types in a pre-determined manner, similar to how servlet spec's 
standard error-page/exception-type configuration option allows you to map 
exception types to URLs. At times, it's simpler to just catch exceptions at t
 he outermost layer of your application instead of carrying a typed exception 
through multiple layers of abstractions just so you could show a sensible error 
message to the user, especially if you can't do anything more clever about it 
anyway. Exception type mapping in Tapestry is much more powerful than what the 
servlet spec dictates. If your email service or an external payment service 
goes down, you can't do much more than display an error message to the user, so 
why would you need to implement separate pages for each exception? Often, it'd 
be nicer if you could just reuse the page template for any fatal exception and 
simply display a different error message. In addition to contributing handlers 
for specific types of exceptions, you may also provide context for rendering 
the same error page template with a different output.</p><p>You can contribute 
an error page, mapping it to an exception type:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent pane
 lContent pdl">
+                <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="error-page-recipe.html">Error Page Recipe</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="specific-errors-faq.html">Specific Errors 
FAQ</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="overriding-exception-reporting.html">Overriding Exception Reporting</a>
+                
+                        
+                    </div>
+    </li></ul>
+</div>
+
+
+<p>Feedback is vitally important when developing an application, and that is 
one of the areas where Tapestry has always excelled.</p><p>Especially during 
development, requests can fail. There can be errors in templates, broken code 
in your application, or something unexpected.</p><p><style 
type="text/css">/*<![CDATA[*/
+div.rbtoc1524341981608 {padding: 0px;}
+div.rbtoc1524341981608 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1524341981608 li {margin-left: 0px;padding-left: 0px;}
+
+/*]]>*/</style></p><div class="toc-macro rbtoc1524341981608">
+<ul class="toc-indentation"><li><a  
href="#RuntimeExceptions-Build-inExceptionReportPage">Build-in Exception Report 
Page</a></li><li><a  
href="#RuntimeExceptions-DetailedExceptionReportFiles">Detailed Exception 
Report Files</a></li><li><a  
href="#RuntimeExceptions-AjaxDetailedExceptionReports">Ajax Detailed Exception 
Reports</a></li><li><a  
href="#RuntimeExceptions-OverridingtheHandlingofSpecificExceptions">Overriding 
the Handling of Specific Exceptions</a></li></ul>
+</div><h2 id="RuntimeExceptions-Build-inExceptionReportPage">Build-in 
Exception Report Page</h2><p>Tapestry has a built-in exception report page that 
captures an amazing wealth of information:</p><p><span 
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img 
class="confluence-embedded-image confluence-content-image-border" width="500" 
src="runtime-exceptions.data/Exception_Stack_Trace.png"></span></p><p><span 
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img 
class="confluence-embedded-image confluence-content-image-border" width="500" 
src="runtime-exceptions.data/Exception_Request.png"></span></p><p><span 
class="confluence-embedded-file-wrapper confluence-embedded-manual-size"><img 
class="confluence-embedded-image confluence-content-image-border" height="443" 
width="500" 
src="runtime-exceptions.data/Application_Exception.png"></span></p><p>This 
exception report features:</p><ul><li>The full stack of exceptions, top to 
bottom.</li><
 li>All non-null properties of each exception.</li><li>The stack 
trace&#160;<em>at the deepest 
level</em>.</li><li>Key&#160;<strong>request</strong> properties, header, 
attributes, and 
parameters.</li><li>Key&#160;<strong>session</strong><em>&#160;</em>propertes</li><li>A
 break down of the&#160;<em>thread</em> in your application</li><li>A listing 
of all JVM System properties</li></ul><h2 
id="RuntimeExceptions-DetailedExceptionReportFiles">Detailed Exception Report 
Files</h2><p>In addition, Tapestry will write a text file for the exception 
with a similar level of detail. The default location for the detailed exception 
report files is a relative directory <em>build/exceptions</em>. You can 
configure the location by setting <a  class="external-link" 
href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/SymbolConstants.html#EXCEPTION_REPORTS_DIR";>SymbolConstants.EXCEPTION_REPORTS_DIR</a>.</p><p>If
 you want to turn off the writing of detailed exception reports files to th
 e file system, you can add the following to your application module (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;">     /**
+     * By default, Tapestry's ExceptionReporter implementation writes verbose 
text files to the
+     * "build/exceptions" directory. This replaces that implementation with 
one that does nothing.
+     * (The exceptions still get logged elsewhere.)
+     */
+    @Decorate(serviceInterface = ExceptionReporter.class)
+    public static ExceptionReporter preventExceptionFileWriting(final 
ExceptionReporter exceptionReporter) {
+        return new ExceptionReporter() {
+            @Override
+            public void reportException(Throwable exception) {
+            }
+        };
+    }</pre>
+</div></div><h2 id="RuntimeExceptions-AjaxDetailedExceptionReports">Ajax 
Detailed Exception Reports</h2><p>A similar detailed exception report is also 
built-in to Tapestry's Ajax support. When an Ajax request fails, Tapestry's 
client-side code will create an &lt;iframe&gt; to present this same 
information:</p><p><span class="confluence-embedded-file-wrapper 
confluence-embedded-manual-size"><img class="confluence-embedded-image 
confluence-content-image-border" height="359" width="500" 
src="runtime-exceptions.data/Exception_Ajax.png"></span></p><h2 
id="RuntimeExceptions-OverridingtheHandlingofSpecificExceptions">Overriding the 
Handling of Specific Exceptions</h2><p>In production, you may want to <a  
href="overriding-exception-reporting.html">override the exception report 
page</a> (even if you keep the text file output). However, Tapestry's (from 
version 5.4) default exception reporter also allows you to handle specific 
exception types in a pre-determined manner, similar to how servlet
  spec's standard error-page/exception-type configuration option allows you to 
map exception types to URLs. At times, it's simpler to just catch exceptions at 
the outermost layer of your application instead of carrying a typed exception 
through multiple layers of abstractions just so you could show a sensible error 
message to the user, especially if you can't do anything more clever about it 
anyway. Exception type mapping in Tapestry is much more powerful than what the 
servlet spec dictates. If your email service or an external payment service 
goes down, you can't do much more than display an error message to the user, so 
why would you need to implement separate pages for each exception? Often, it'd 
be nicer if you could just reuse the page template for any fatal exception and 
simply display a different error message. In addition to contributing handlers 
for specific types of exceptions, you may also provide context for rendering 
the same error page template with a different output.<
 /p><p>You can contribute an error page, mapping it to an exception 
type:</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 void 
contributeExceptionHandler(MappedConfiguration&lt;Class, Class&gt; 
configuration) {
         configuration.add(SmtpNotRespondingException.class, 
ServiceFailure.class);
     }</pre>
-</div></div><p>If a simple exception type to page mapping doesn't do it for 
you, you can also contribute a custom handler for that particular exception 
type. An <em>ExceptionHandlerAssistant</em> can contain arbitrarily complex 
logic for handling a specific exception type and use other Tapestry services. 
If <em>ExceptionHandlerAssistant.handleRequestException(Throwable exception, 
List&lt;Object&gt; exceptionContext)</em> returns an Object representing an URL 
the main handler will issue a redirect to that URL. It's valid to return either 
a String, a Link or a Class; the last case implies a page class. If the 
<em>ExceptionHandlerAssistant</em> returns null, it's assumed that the 
assistant has independently handled the exception. You can either contribute an 
instance of an <em>ExceptionHandlerAssistant</em> or a class that implements 
<em>ExceptionHandlerAssistant</em>. Below, we contribute an instance handling 
<em>ServiceException</em>s:</p><div class="code panel pdl" style="border-wid
 th: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">    public void 
contributeExceptionHandler(OperationQueue 
-operationQueue, MappedConfiguration&lt;Class, Class&gt; configuration) {
+</div></div><p>If a simple exception type to page mapping doesn't do it for 
you, you can also contribute a custom handler for that particular exception 
type. An <em>ExceptionHandlerAssistant</em> can contain arbitrarily complex 
logic for handling a specific exception type and use other Tapestry services. 
If <em>ExceptionHandlerAssistant.handleRequestException(Throwable exception, 
List&lt;Object&gt; exceptionContext)</em> returns an Object representing an URL 
the main handler will issue a redirect to that URL. It's valid to return either 
a String, a Link or a Class; the last case implies a page class. If the 
<em>ExceptionHandlerAssistant</em> returns null, it's assumed that the 
assistant has independently handled the exception. You can either contribute an 
instance of an <em>ExceptionHandlerAssistant</em> or a class that implements 
<em>ExceptionHandlerAssistant</em>. Below, we contribute an instance handling 
<em>ServiceException</em>s:</p><div class="code panel pdl" style="border-wid
 th: 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 void 
contributeExceptionHandler(OperationQueue operationQueue, 
MappedConfiguration&lt;Class, Class&gt; configuration) {
         final ExceptionHandlerAssistant assistant = new 
ExceptionHandlerAssistant() {
         @Override
         public Object handleRequestException(Throwable exception, 
List&lt;Object&gt; exceptionContext) throws IOException {
@@ -95,11 +157,11 @@ operationQueue, MappedConfiguration&lt;C
         };
         configuration.add(ServiceException.class, assistant);
     }</pre>
-</div></div><p>You can also specify context for the exception page. For 
generic exceptions, the context is taken from the exception class name minus 
the word "Exception" in case that's how the class name ends. For example, you 
have a following class:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+</div></div><p>You can also specify context for the exception page. For 
generic exceptions, the context is taken from the exception class name minus 
the word "Exception" in case that's how the class name ends. For example, you 
have a following class:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>SmtpNotResponding.java</b></div><div class="codeContent panelContent 
pdl">
 <pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">public class SmtpNotRespondingException extends 
RuntimeException {
 &#160;...
 }</pre>
-</div></div><p>If an <em>SmtpNotRespondingException</em> is thrown during an 
action request, user is directed to <em>ServiceFailure</em> page with a String 
context smtpnotresponding (i.e. to URL 
<strong>/servicefailure/smtpnotresponding</strong>). The contributed exception 
handling works both for regular action requests and ajax action requests. In 
the latter case, the module will use Javascript to redirect to the error page. 
If the exception thrown is not one of the contributed types, the exception is 
handled like any other exception, as explained above.</p><p>If your 
custom-handled exception implements the interface 
<em>org.apache.tapestry5.ContextAwareException</em> you can fully specify the 
context for the error page. For example, you could implement a following 
Exception class:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div><p>If an <em>SmtpNotRespondingException</em> is thrown during an 
action request, user is directed to <em>ServiceFailure</em> page with a String 
context smtpnotresponding (i.e. to URL 
<strong>/servicefailure/smtpnotresponding</strong>). The contributed exception 
handling works both for regular action requests and ajax action requests. In 
the latter case, the module will use Javascript to redirect to the error page. 
If the exception thrown is not one of the contributed types, the exception is 
handled like any other exception, as explained above.</p><p>If your 
custom-handled exception implements the interface 
<em>org.apache.tapestry5.ContextAwareException</em> you can fully specify the 
context for the error page. For example, you could implement a following 
Exception class:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeHeader panelHeader pdl" style="border-bottom-width: 
1px;"><b>SmtpNotRespondingException.java</b></div><div class="codeContent pan
 elContent pdl">
 <pre class="brush: java; gutter: false; theme: Default" 
style="font-size:12px;">    public class SmtpNotRespondingException extends 
RuntimeException implements ContextAwareException {
         private Object[] context;  
         public EmailServiceException(Object[] context) {


Reply via email to