deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1588456 - /deltaspike/site/trunk/content/jsf.mdtext
Date Fri, 18 Apr 2014 12:24:28 GMT
Author: gpetracek
Date: Fri Apr 18 12:24:27 2014
New Revision: 1588456

URL: http://svn.apache.org/r1588456
Log:
updated content

Modified:
    deltaspike/site/trunk/content/jsf.mdtext

Modified: deltaspike/site/trunk/content/jsf.mdtext
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/jsf.mdtext?rev=1588456&r1=1588455&r2=1588456&view=diff
==============================================================================
--- deltaspike/site/trunk/content/jsf.mdtext (original)
+++ deltaspike/site/trunk/content/jsf.mdtext Fri Apr 18 12:24:27 2014
@@ -666,6 +666,29 @@ This annotation is a custom view-meta-da
         }
     }
 
+
+Since v0.7 it's possible to observe exceptions thrown by a @PreRenderView callback and use
your configured Default-Error-View to display the exception.
+
+Example:
+
+    :::java
+    @ExceptionHandler
+    public class ErrorViewAwareExceptionHandler {
+        @Inject
+        private ViewConfigResolver viewConfigResolver;
+
+        public void onIllegalStateException(@Handles ExceptionEvent<IllegalStateException>
e)
+        {
+            FacesContext facesContext = FacesContext.getCurrentInstance();
+
+            String viewId = viewConfigResolver.getDefaultErrorViewConfigDescriptor().getViewId();
+            UIViewRoot viewRoot = facesContext.getApplication().getViewHandler().createView(facesContext,
viewId);
+            facesContext.setViewRoot(viewRoot);
+            //... - e.g.: store the exception in a page-bean for the default-error-view
+        }
+    }
+
+
 ### Referencing Views via @ViewRef
 With `@ViewControllerRef#value` you can annotate a view-config class to bind (/reference)
a controller to it. `@ViewRef#config` allows the same in the other direction.
 Use an existing view-config to reference one or many view/s.



Mime
View raw message