Partial AJAX calls don't handle container session timeouts

UI Components for JSF
Post Reply
nickw
Posts: 1
Joined: 09 Aug 2011, 16:06

09 Aug 2011, 16:24

Hi,
I'm using the following:

Glassfish 3.1
Mojarra 2.1.0 (included with Glassfish)
Primefaces 3.0M2

I'm using container security with form based login. I have a secured page that contains a p:commandButton that updates part of the page. All works fine whilst the user is logged in.

Once the session times out the application appears to lock up. What is happening is that the partial AJAX request from the button is expecting an XML response, but Glassfish sends it the HTML for the login page instead (as it should, the session has timed out). Would it be possible to get the partial request code to handle this situation, maybe refresh the whole page to allow the container redirect to work?

I've created a small war file/eclipse project to demonstrate the problem. I can provide that on request.
Regards,

Nick

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

09 Aug 2011, 16:38

Issue already exists: http://code.google.com/p/primefaces/iss ... il?id=1843

You could write an own exceptionhandler and redirect on session expiration (viewtopic.php?f=3&t=2631)
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

09 Aug 2011, 16:51

This is an important one, I'll take this into M3.

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

09 Aug 2011, 16:57

Great, thanks cagatay!
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

09 Aug 2011, 17:19

So how should we solve this case, any feedback is welcome. Probably we should implement it in onerror callback of ajax request.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

09 Aug 2011, 17:22

This is what we get in case of error;

Code: Select all

<?xml version='1.0' encoding='UTF-8'?>
<partial-response><error><error-name>class javax.faces.application.ViewExpiredException</error-name><error-message><![CDATA[viewId:/ui/pprUpdate.jsf - View /ui/pprUpdate.jsf could not be restored.]]></error-message></error></partial-response>
So you catch the exceptin and send a redirect to login page right?

User avatar
Oleg
Expert Member
Posts: 3805
Joined: 02 Oct 2009, 09:41
Location: Germany, Black Forest

09 Aug 2011, 18:19

Hi,

Maybe this can help you:

http://ovaraksin.blogspot.com/2010/10/j ... meout.html
http://ovaraksin.blogspot.com/2010/10/g ... ecked.html

I use that in all my web apps with success.
PrimeFaces Cookbook (2. edition): http://ova2.github.io/primefaces-cookbook/ Learning Angular UI Development with PrimeNG: https://github.com/ova2/angular-develop ... th-primeng Blog: https://medium.com/@OlegVaraksin

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

09 Aug 2011, 18:27

Will check, thx!

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

09 Aug 2011, 18:30

Hmm yep i think onerror with the error message and type should be ok and should also be flexible enough. What do you think?
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

09 Aug 2011, 18:31

Also then onerror should be possible on fileupload etc. too!
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 23 guests