[seam-commits] Seam SVN: r15414 - in branches/enterprise/WFK-2_1/jboss-seam/src/main: resources/META-INF and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Feb 19 11:27:26 EST 2013


Author: manaRH
Date: 2013-02-19 11:27:26 -0500 (Tue, 19 Feb 2013)
New Revision: 15414

Added:
   branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamExceptionHandlerFactory.java
Modified:
   branches/enterprise/WFK-2_1/jboss-seam/src/main/resources/META-INF/faces-config.xml
Log:
readd JBSEAM-5045

Added: branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamExceptionHandlerFactory.java
===================================================================
--- branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamExceptionHandlerFactory.java	                        (rev 0)
+++ branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamExceptionHandlerFactory.java	2013-02-19 16:27:26 UTC (rev 15414)
@@ -0,0 +1,49 @@
+package org.jboss.seam.jsf;
+
+import javax.faces.context.ExceptionHandler;
+import javax.faces.context.ExceptionHandlerFactory;
+import javax.faces.context.FacesContext;
+
+import org.jboss.seam.web.ExceptionFilter;
+
+import com.sun.faces.application.ApplicationAssociate;
+import com.sun.faces.context.AjaxExceptionHandlerImpl;
+import com.sun.faces.context.ExceptionHandlerImpl;
+
+
+
+/**
+ * Factory not to be used AjaxExceptionHandlerImpl class and 
+ * always be an exception to be thrown by capturad ExceptionFilter
+ * 
+ * @see AjaxExceptionHandlerImpl
+ * @see ExceptionFilter  
+ * @author Tiago Peruzzo
+ * 
+ */
+public class SeamExceptionHandlerFactory extends ExceptionHandlerFactory {
+
+	private ApplicationAssociate associate;
+
+
+	@Override
+    public ExceptionHandler getExceptionHandler() {
+        FacesContext fc = FacesContext.getCurrentInstance();
+        ApplicationAssociate associate = getAssociate(fc);
+        return new ExceptionHandlerImpl(((associate != null) ? associate.isErrorPagePresent() : Boolean.TRUE));
+    }
+
+
+    // --------------------------------------------------------- Private Methods
+
+    private ApplicationAssociate getAssociate(FacesContext ctx) {
+        if (associate == null) {
+            associate = ApplicationAssociate.getCurrentInstance();
+            if (associate == null) {
+                associate = ApplicationAssociate.getInstance(ctx.getExternalContext());
+            }
+        }
+        return associate;
+    }
+	
+}

Modified: branches/enterprise/WFK-2_1/jboss-seam/src/main/resources/META-INF/faces-config.xml
===================================================================
--- branches/enterprise/WFK-2_1/jboss-seam/src/main/resources/META-INF/faces-config.xml	2013-02-19 16:27:13 UTC (rev 15413)
+++ branches/enterprise/WFK-2_1/jboss-seam/src/main/resources/META-INF/faces-config.xml	2013-02-19 16:27:26 UTC (rev 15414)
@@ -6,6 +6,7 @@
 
    <factory>
       <application-factory>org.jboss.seam.jsf.SeamApplicationFactory</application-factory>
+      <exception-handler-factory>org.jboss.seam.jsf.SeamExceptionHandlerFactory</exception-handler-factory>
    </factory>
 
    <application>



More information about the seam-commits mailing list