From 4902142157b8b64a5ed0daaa4b06fd0f86c55075 Mon Sep 17 00:00:00 2001 From: "Niels Erik G. Nielsen" Date: Thu, 28 Feb 2013 19:45:49 -0500 Subject: [PATCH] Removes non-generic elements from utility package --- src/META-INF/faces-config.xml | 4 -- .../exceptions/CustomExceptionHandler.java | 49 -------------------- .../exceptions/CustomExceptionHandlerFactory.java | 20 -------- 3 files changed, 73 deletions(-) delete mode 100644 src/main/java/com/indexdata/pz2utils4jsf/exceptions/CustomExceptionHandler.java delete mode 100644 src/main/java/com/indexdata/pz2utils4jsf/exceptions/CustomExceptionHandlerFactory.java diff --git a/src/META-INF/faces-config.xml b/src/META-INF/faces-config.xml index 8e033da..a7b9df0 100644 --- a/src/META-INF/faces-config.xml +++ b/src/META-INF/faces-config.xml @@ -3,8 +3,4 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd" version="2.1"> - - - com.indexdata.pz2utils4jsf.exceptions.CustomExceptionHandlerFactory - \ No newline at end of file diff --git a/src/main/java/com/indexdata/pz2utils4jsf/exceptions/CustomExceptionHandler.java b/src/main/java/com/indexdata/pz2utils4jsf/exceptions/CustomExceptionHandler.java deleted file mode 100644 index 048ef05..0000000 --- a/src/main/java/com/indexdata/pz2utils4jsf/exceptions/CustomExceptionHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.indexdata.pz2utils4jsf.exceptions; - -import java.util.Iterator; - -import javax.faces.FacesException; -import javax.faces.application.NavigationHandler; -import javax.faces.application.ViewExpiredException; -import javax.faces.context.ExceptionHandler; -import javax.faces.context.ExceptionHandlerWrapper; -import javax.faces.context.FacesContext; -import javax.faces.event.ExceptionQueuedEvent; -import javax.faces.event.ExceptionQueuedEventContext; - -public class CustomExceptionHandler extends ExceptionHandlerWrapper { - - private ExceptionHandler wrapped; - - public CustomExceptionHandler (ExceptionHandler wrapped) { - this.wrapped = wrapped; - } - - @Override - public ExceptionHandler getWrapped() { - return this.wrapped; - } - - @Override - public void handle() throws FacesException { - for (Iterator i = getUnhandledExceptionQueuedEvents().iterator(); i.hasNext();) { - ExceptionQueuedEvent event = i.next(); - ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource(); - Throwable t = context.getException(); - if (t instanceof ViewExpiredException) { - // ViewExpiredException vee = (ViewExpiredException) t; - FacesContext fc = FacesContext.getCurrentInstance(); - // Map requestMap = fc.getExternalContext().getRequestMap(); - NavigationHandler nav = fc.getApplication().getNavigationHandler(); - context.getContext().getPartialViewContext().setRenderAll(true); - try { - nav.handleNavigation(fc, null, "search"); - fc.renderResponse(); - } finally { - i.remove(); - } - } - } - getWrapped().handle(); - } -} diff --git a/src/main/java/com/indexdata/pz2utils4jsf/exceptions/CustomExceptionHandlerFactory.java b/src/main/java/com/indexdata/pz2utils4jsf/exceptions/CustomExceptionHandlerFactory.java deleted file mode 100644 index ee60210..0000000 --- a/src/main/java/com/indexdata/pz2utils4jsf/exceptions/CustomExceptionHandlerFactory.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.indexdata.pz2utils4jsf.exceptions; - -import javax.faces.context.ExceptionHandler; -import javax.faces.context.ExceptionHandlerFactory; - -public class CustomExceptionHandlerFactory extends ExceptionHandlerFactory { - - private ExceptionHandlerFactory parent; - - public CustomExceptionHandlerFactory (ExceptionHandlerFactory parent) { - this.parent = parent; - } - @Override - public ExceptionHandler getExceptionHandler() { - ExceptionHandler result = parent.getExceptionHandler(); - result = new CustomExceptionHandler(result); - return result; - } - -} -- 1.7.10.4