/**
  * Handles the exception thrown at the end of a conversation redirecting the flow to a pretty page
  * instead of printing a stacktrace on the screen.
  *
  * @param event
  * @param log
  */
 public void conversationEndedExceptionHandler(
     @Handles CaughtException<NonexistentConversationException> event, Logger log) {
   log.info("Conversation ended: " + event.getException().getMessage());
   try {
     facesContext.getExternalContext().redirect("conversation_ended");
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
 public void conversationEndedExceptionHandler(
     @Handles(precedence = 100) CaughtException<ViewExpiredException> event,
     Logger log,
     HttpConversationContext conversationContext,
     FacesContext facesContext) {
   log.warn("View expired, redirecting to error page");
   conversationContext.activate(null);
   event.handled();
   facesContext
       .getApplication()
       .getNavigationHandler()
       .handleNavigation(facesContext, "*", "viewExpired");
 }