This content has been marked as final.
Show 1 reply
-
1. Re: Graceful handling of expired conversation
asiandub May 18, 2011 4:45 AM (in response to robertgary1)Option 1:
Write your own ExceptionHandlerFactory / ExceptionHandler (and register it in faces-config.xml). Have a look at Seam-Catch how they did it...
public class MyExceptionHandlerFactory extends ExceptionHandlerFactory { ... public class MyExceptionHandler extends ExceptionHandlerWrapper { ... private HandledException handleException(Throwable t, FacesContext facesContext) { ResourceBundle messages = this.getMessageBundle(facesContext); List<Throwable> exceptionStack = this.createExceptionStack(t); for (Throwable cause : exceptionStack) { if (cause instanceof NonexistentConversationException) { this.log.debugv(t, "Handling conversation timeout exception {0}", cause.getClass().getName()); return new HandledException(messages.getString("error.sessionTimeout"), cause); } else if (cause instanceof ViewExpiredException) { this.log.debugv(t, "Handling session timeout exception {0}", cause.getClass().getName()); return new HandledException(messages.getString("error.sessionTimeout"), cause); } ... } this.log.errorv(t, "Handling exception {0}", t.getClass().getName()); return new HandledException(messages.getString("error.general"), t); } ... }
Option 2:
Use Seam-Catch :-)
I used both options (Seam-Catch wasn't released back then), both workes...
Cheers,
Jan