[seam-commits] Seam SVN: r15420 - branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Feb 21 11:01:52 EST 2013


Author: manaRH
Date: 2013-02-21 11:01:52 -0500 (Thu, 21 Feb 2013)
New Revision: 15420

Added:
   branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamExceptionHandler.java
Modified:
   branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamExceptionHandlerFactory.java
Log:
replaced dependency on JSF-IMPL in ExceptionHandlerFactory

Added: branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamExceptionHandler.java
===================================================================
--- branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamExceptionHandler.java	                        (rev 0)
+++ branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamExceptionHandler.java	2013-02-21 16:01:52 UTC (rev 15420)
@@ -0,0 +1,38 @@
+package org.jboss.seam.jsf;
+
+import javax.faces.FacesException;
+import javax.faces.context.ExceptionHandler;
+import javax.faces.context.ExceptionHandlerWrapper;
+
+public class SeamExceptionHandler extends ExceptionHandlerWrapper
+{
+
+   private ExceptionHandler wrapped;
+
+   /**
+    * Construct a new ajax exception handler around the given wrapped exception handler.
+    * @param wrapped The wrapped exception handler.
+    */
+   public SeamExceptionHandler(ExceptionHandler wrapped)
+   {
+           this.wrapped = wrapped;
+   }
+
+   // Actions --------------------------------------------------------------------------------------------------------
+
+   /**
+    * Handle the ajax exception by default ExceptionHandler
+    * 
+    */
+   @Override
+   public void handle() throws FacesException {
+           wrapped.handle();
+   }
+
+   @Override
+   public ExceptionHandler getWrapped() {
+           return wrapped;
+   }
+
+}
+

Modified: 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	2013-02-21 12:52:09 UTC (rev 15419)
+++ branches/enterprise/WFK-2_1/jboss-seam/src/main/java/org/jboss/seam/jsf/SeamExceptionHandlerFactory.java	2013-02-21 16:01:52 UTC (rev 15420)
@@ -2,16 +2,7 @@
 
 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
@@ -19,31 +10,32 @@
  * @see AjaxExceptionHandlerImpl
  * @see ExceptionFilter  
  * @author Tiago Peruzzo
+ * @author Marek Novotny - mnovotny at redhat.com
  * 
+ * 
  */
-public class SeamExceptionHandlerFactory extends ExceptionHandlerFactory {
+public class SeamExceptionHandlerFactory extends ExceptionHandlerFactory 
+{
 
-	private ApplicationAssociate associate;
+   private ExceptionHandlerFactory wrapped;
+   
+   public SeamExceptionHandlerFactory(ExceptionHandlerFactory parent)
+   {
+      this.wrapped = parent;
+   }
 
-
 	@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;
-    }
+   public ExceptionHandler getExceptionHandler()
+   {
+      return new SeamExceptionHandler(wrapped.getExceptionHandler()); 
+   }
 	
+	  /**
+    * Returns the wrapped factory.
+    */
+   @Override
+   public ExceptionHandlerFactory getWrapped() {
+           return wrapped;
+   }
+
 }



More information about the seam-commits mailing list