• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Handling Session timeout with ajax
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling Session timeout with ajax


  • Subject: Re: Handling Session timeout with ajax
  • From: Chuck Hill <email@hidden>
  • Date: Mon, 26 Jan 2009 18:40:27 -0800


On Jan 26, 2009, at 5:25 PM, Paul Hoadley wrote:

On 27/01/2009, at 7:55 AM, Chuck Hill wrote:

Should this also work in Application.handleException()? I've got this:

public WOResponse handleException(Exception anException, WOContext aContext) {
AMErrorPage errorPage = (AMErrorPage) pageWithName(AMErrorPage.class
.getName(), aContext);
errorPage.setPageType(AMErrorPage.EXCEPTION);
if (AjaxUtils.isAjaxRequest(aContext.request())) {
AjaxUtils.redirectTo(errorPage);
return errorPage.context().response();
}
return errorPage.generateResponse();
}


Throwing an exception from an Ajax action bypasses my AMErrorPage, somehow logs me out of the app, and returns my Main page. I can't even see how it's occurring. There's literally nothing in the console beyond a log message from AMErrorPage.setPageType(). Again, this is a slightly different issue than the OP, and I assume your code above was for Application.handleSessionRestorationErrorInContext.

I have the same code (more or less) and it worked the last time that I tested it. It sounds like there might be some other request getting to the app after the one causing the exception. Try overridding dispatchRequest and logging out each request.uri().

Looks like there is:

Jan 27 11:49:24 AM[54210] WARN NSLog - <er.ajax.AjaxRequestHandler>: Exception occurred while handling request:
java.lang.NullPointerException
Jan 27 11:49:24 AM[54210] INFO NSLog - Application.handleException: Handling an Exception:
[2009-1-27 11:49:24 CST] <WorkerThread1> java.lang.NullPointerException


... [Stack trace of my deliberately-generated NPE deleted]

Unrelated, but you can do this more cleanly with

NSLog.out.appendln(new RuntimeException("backtrace"));
or
new RuntimeException("backtrace").printStackTrace();


Jan 27 11:49:24 AM[54210] INFO NSLog - AMErrorPage.setPageType: pageType = exception
Application.dispatchRequest: URI = /cgi-bin/WebObjects/AM.woa/wo/5.0


That looks unusual (to me).


The thing to do now is to look in that page for something (form, input, link, JavaScript) with that URL. Then try to figure out why that is sending a request after the exception.



Chuck


-- Chuck Hill Senior Consultant / VP Development

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects







_______________________________________________ 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
  • Follow-Ups:
    • Re: Handling Session timeout with ajax
      • From: Paul Hoadley <email@hidden>
References: 
 >Handling Session timeout with ajax (From: Amedeo Mantica <email@hidden>)
 >Re: Handling Session timeout with ajax (From: Chuck Hill <email@hidden>)
 >Re: Handling Session timeout with ajax (From: Paul Hoadley <email@hidden>)
 >Re: Handling Session timeout with ajax (From: Chuck Hill <email@hidden>)
 >Re: Handling Session timeout with ajax (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Re: Sometime WebObjects drives me a little crazy!
  • Next by Date: Accidentally opened workspace with Eclipse 3.4
  • Previous by thread: Re: Handling Session timeout with ajax
  • Next by thread: Re: Handling Session timeout with ajax
  • Index(es):
    • Date
    • Thread