1 Reply Latest reply on Oct 16, 2009 6:41 AM by Nick Belaevski

    My exception handler concept incompatible with RichFaces?

    Christian Kölle Newbie

      Hi,

      when my project started, I came up with the following concept for runtime exception handling:


      • I extended the Faces Servlet. In a big catch-block I distinguish between exceptions representing an expired Session on the one hand, e.g. ViewExpiredException, and all other type of exceptions on the other hand.
      • If the session has expired I do a redirect with HTTP-GET-parameters to the same Servlet-Path where the issue occured. In the Before-Phase of a RESTORE_VIEW-Phase-Listener I will look out for those exception-specific GET-parameters. If they are present, I write a message into the Faces-Message-queue saying something like "Your session has expired and was renewed." This is nice, because the user finds himself where he was.
      • For all other exceptions I will log the error into the Error-LOG with a UUID to identify the error. Then I (try to) invalidate the session and do a redirect to my error-JSF-page, where the error and the UUID of the error will be presented to the user. The UUID of the error will again be communicated via GET-Parameters.
      • In order to get controll over the ViewExpiredState I am checking this state myself in the before Phase of a RESTORE_VIEW-Phase-Listener. If I come to the conclusion, that the session has expired, I will throw a ViewExpired-Exeption myself to trigger the mechanism described before.


        This concept used to work in a plain tomahawk project.

        Unfortunately I think my concept is incompatible with RichFaces, but I am not sure yet. I might miss some background knowledge for proper implementation. Somehow I always end in a neverending loop or the "Session expired" user feedback does not come up.

        Somehow more than one request is running into the RESTORE_VIEW-Phase-Listener: RichFaces Skinning-requests, etc... When I come up with the concept, I was not using my RichFaces-components and ajax-features.

        I would be very glad, if someone could comment on that.

        Regards and thanks in advance.

        Used versions:

        • JSF 1.2 Myfaces-Impl
        • Richfaces 3.3.1
        • Facelets
        • Jetty and Tomcat in development ---> Target JBoss AS