Search code examples
jsf-2primefacesseamviewexpiredexceptionomnifaces

Handling ViewExpiredException (JSF 2.1, Seam2 , Primefaces 3.4.1, Omnifaces 1.3)


I am having terrible problems trying to handle ViewexpiredException correctly using the frameworks JSF 2.1, Seam 2.3, Primefaces 3.4.1, Omnifaces 1.3.

Here you can see a full explanation of my problem I post in primefaces forum: http://forum.primefaces.org/viewtopic.php?f=3&t=28215

In this post I was told to try omnifaces (which I am trying to do now). So I configure it (not sure if correctly) in my project.

I add this to my faces-config.xml:

<application>
<...>
<resource-handler>org.omnifaces.resourcehandler.CombinedResourceHandler</resource-handler> 
<...>
</application>


<factory>
<render-kit-factory>org.omnifaces.renderkit.Html5RenderKitFactory</render-kit-factory>
<exception-handler-factory>org.omnifaces.exceptionhandler.FullAjaxExceptionHandlerFactory</exception-handler-factory>
</factory>

Everything seems to work, the FullAjaxExceptionHandlerFactory seems to try to handle the expcetion and try to redirect to login page (see my last post on the primefaces forum) but the app gets frozen and nothing really happend, I am not quite sure if I made a mistake or something.

I've try almost every solution I found on the internet nothing seems to work for me, when something seems to work I get this page after a login (which I was redirect cause the session tomeout): http://img831.imageshack.us/img831/7459/pic4w.png

Thanks in advance


Solution

  • Thank you very much for you replies. I finally solve it.

    I am not quite sure why, but this atribute login-view-id="/login.xhtml" in the tag "pages" of pages.xml file was avoiding the "process" of this code:

    <exception class="org.jboss.seam.security.NotLoggedInException">
      <redirect view-id="/login.xhtml">
         <message>Debe loguearse para continuar</message>
      </redirect>
    

    After I removed the login-view-id attribute the NotLoggedInException start being handled, but I still had the same problem once I log in so I add and finally that solved the problem, so the fully tag end like this:

    <exception class="org.jboss.seam.security.NotLoggedInException">
       <end-conversation/>
      <redirect view-id="/login.xhtml">
         <message>Debe loguearse para continuar</message>
      </redirect>
    

    Thank you very much!