Re: Handling Session timeout with ajax
Re: Handling Session timeout with ajax
- Subject: Re: Handling Session timeout with ajax
- From: Robert Tupelo-Schneck <email@hidden>
- Date: Fri, 30 Jan 2009 17:29:05 -0500
On Jan 30, 2009, at 5:03 PM, Chuck Hill wrote:
On Jan 30, 2009, at 1:14 PM, Robert Tupelo-Schneck wrote:
It doesn't seem to work correctly when I click an
AjaxTabbedPanelTab. In that case the tab fills with something that
looks like the normal WebObjects session timeout page with a bit of
javascript tacked on the end; in fact, if I peek at
redirect.contentString(), I get
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>Missing Session Error</title>
...
</html>
document.location.href='/cgi-bin/WebObjects/WOPrefixReg.woa/wo/1.0';
Any idea why the <script> etc. is left off in the tab case?
That is not the question. The question is why that HTML is in
there. It looks like it is getting generated _before_
AjaxUtils.redirectTo(errorPage) is getting called. Is there
anything going on before this in your exception handling method?
Here's my code:
public WOResponse errorPageWith(WOContext aContext, String title,
String message) {
if(aContext.hasSession()) {
aContext.session().terminate();
}
ErrorPage errorPage = pageWithName(ErrorPage.class,aContext);
errorPage.title = title;
errorPage.message = message;
if (AjaxUtils.isAjaxRequest(aContext.request())) {
// Create redirect to return to break out of Ajax
AjaxUtils.redirectTo(errorPage);
WOResponse redirect = errorPage.context().response();
// Generate the error page so that it gets into the page
cache, don't do this earlier!
errorPage.generateResponse();
NSLog.out.appendln(redirect.contentString());
return redirect;
}
return errorPage.generateResponse();
}
@Override
public WOResponse handleException(Exception anException,
WOContext aContext)
{
super.handleException(anException, aContext);
return errorPageWith(aContext,"Error", "A server error has
occurred.");
}
@Override
public WOResponse handlePageRestorationErrorInContext(WOContext
context) {
super.handlePageRestorationErrorInContext(context);
return errorPageWith(context,"Navigation Error", "An error
has occurred; you may have used the back button too many times.");
}
@Override
public WOResponse handleSessionCreationErrorInContext(WOContext
context) {
super.handleSessionCreationErrorInContext(context);
return errorPageWith(context,"Error", "A server error has
occurred.");
}
@Override
public WOResponse
handleSessionRestorationErrorInContext(WOContext context) {
super.handleSessionRestorationErrorInContext(context);
return errorPageWith(context,"Session Closed", "Your session
has been closed or timed out due to inactivity.");
}
Also, are you storing the session ID in cookies? If not, you need a
newer version of Wonder. I fixed a bug there earlier this week.
I just got Wonder-latest, thanks!
Robert
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden