+++ /dev/null
-package com.indexdata.pz2utils4jsf.exceptions;\r
-\r
-import java.util.Iterator;\r
-\r
-import javax.faces.FacesException;\r
-import javax.faces.application.NavigationHandler;\r
-import javax.faces.application.ViewExpiredException;\r
-import javax.faces.context.ExceptionHandler;\r
-import javax.faces.context.ExceptionHandlerWrapper;\r
-import javax.faces.context.FacesContext;\r
-import javax.faces.event.ExceptionQueuedEvent;\r
-import javax.faces.event.ExceptionQueuedEventContext;\r
-\r
-public class CustomExceptionHandler extends ExceptionHandlerWrapper {\r
-\r
- private ExceptionHandler wrapped;\r
- \r
- public CustomExceptionHandler (ExceptionHandler wrapped) {\r
- this.wrapped = wrapped;\r
- }\r
- \r
- @Override\r
- public ExceptionHandler getWrapped() {\r
- return this.wrapped;\r
- }\r
-\r
- @Override\r
- public void handle() throws FacesException {\r
- for (Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator(); i.hasNext();) {\r
- ExceptionQueuedEvent event = i.next();\r
- ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();\r
- Throwable t = context.getException();\r
- if (t instanceof ViewExpiredException) {\r
- // ViewExpiredException vee = (ViewExpiredException) t;\r
- FacesContext fc = FacesContext.getCurrentInstance();\r
- // Map<String, Object> requestMap = fc.getExternalContext().getRequestMap();\r
- NavigationHandler nav = fc.getApplication().getNavigationHandler();\r
- context.getContext().getPartialViewContext().setRenderAll(true); \r
- try {\r
- nav.handleNavigation(fc, null, "search");\r
- fc.renderResponse();\r
- } finally {\r
- i.remove();\r
- }\r
- }\r
- }\r
- getWrapped().handle();\r
- }\r
-}\r
+++ /dev/null
-package com.indexdata.pz2utils4jsf.exceptions;\r
-\r
-import javax.faces.context.ExceptionHandler;\r
-import javax.faces.context.ExceptionHandlerFactory;\r
-\r
-public class CustomExceptionHandlerFactory extends ExceptionHandlerFactory {\r
-\r
- private ExceptionHandlerFactory parent;\r
- \r
- public CustomExceptionHandlerFactory (ExceptionHandlerFactory parent) {\r
- this.parent = parent;\r
- }\r
- @Override\r
- public ExceptionHandler getExceptionHandler() {\r
- ExceptionHandler result = parent.getExceptionHandler();\r
- result = new CustomExceptionHandler(result);\r
- return result;\r
- }\r
-\r
-}\r