You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by hn...@apache.org on 2017/11/23 16:04:00 UTC

[myfaces-tobago] branch master updated: TOBAGO-1793 Ajax Error Handling * fix NullPointerException if no error page is defined in web.xml * improve AjaxExceptionHandler description

This is an automated email from the ASF dual-hosted git repository.

hnoeth pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git


The following commit(s) were added to refs/heads/master by this push:
     new dd02415  TOBAGO-1793 Ajax Error Handling * fix NullPointerException if no error page is defined in web.xml * improve AjaxExceptionHandler description
dd02415 is described below

commit dd0241524eddb0f1af02281edae0662d0ee8acdb
Author: Henning Noeth <hn...@apache.org>
AuthorDate: Thu Nov 23 17:03:53 2017 +0100

    TOBAGO-1793 Ajax Error Handling
    * fix NullPointerException if no error page is defined in web.xml
    * improve AjaxExceptionHandler description
---
 .../src/main/java/org/apache/myfaces/tobago/util/WebXmlUtils.java | 4 ++++
 .../30-concept/22-exception-handler/exception-handler.xhtml       | 8 +++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/util/WebXmlUtils.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/util/WebXmlUtils.java
index bb19c1f..2d4a3d2 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/util/WebXmlUtils.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/util/WebXmlUtils.java
@@ -169,6 +169,10 @@ public class WebXmlUtils {
   }
 
   private static String normalizePath(final ExternalContext externalContext, final String path) {
+    if (path == null) {
+      return null;
+    }
+
     if (externalContext.getRequestPathInfo() != null) {
       final String prefix = externalContext.getRequestServletPath();
       if (path.startsWith(prefix)) {
diff --git a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/22-exception-handler/exception-handler.xhtml b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/22-exception-handler/exception-handler.xhtml
index d718340..cdeed32 100644
--- a/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/22-exception-handler/exception-handler.xhtml
+++ b/tobago-example/tobago-example-demo/src/main/webapp/content/30-concept/22-exception-handler/exception-handler.xhtml
@@ -26,10 +26,16 @@
   <ui:param name="title" value="#{demoBundle.exception_handler}"/>
   <p>Since Tobago 4.0.0 an AjaxExceptionHandler takes care of exceptions in ajax case.</p>
   <p><span class="#{demo:bootstrapClass('BADGE')} #{demo:bootstrapClass('BADGE_DANGER')}">Important!</span>
-    The exception has to be throwns before the renderer phase.
+    The exception has to be thrown before the renderer phase.
     This is the case, in normal actions, but if you need e. g. some initialization of data in a page, you
     can achieve that with an
     <code class="language-markup">&lt;f:event type="preRenderView" listener="\#{bean.doSomeCriticalWork}"/></code>.</p>
+  <p>The AjaxExceptionHandler take the first exception that occurs and try to find a proper error page.
+    Error pages are defined in the web.xml.</p>
+  <p>If no proper error page could be found, the error page for error code 500 is displayed instead.
+    If no 500-error-page is defined, the general error page (no exceptiontype or error code defined) is used.</p>
+  <p>If there is no ajax case, the error page could not be found or the renderer phase is active,
+    the AjaxExceptionHandler do nothing and let JSF handle the exception.</p>
 
   <tc:section label="Example One">
     <p>The output field is updated after an change event of the input field.</p>

-- 
To stop receiving notification emails like this one, please contact
['"commits@myfaces.apache.org" <co...@myfaces.apache.org>'].