• 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: Ajax Requests and Session Timeouts
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ajax Requests and Session Timeouts


  • Subject: Re: Ajax Requests and Session Timeouts
  • From: Timo Hoepfner <email@hidden>
  • Date: Mon, 22 Nov 2010 21:00:00 +0100

Hy Johnny,

this is what I'm using in some of our apps in the WOApplication subclass:

	@Override
	public WOResponse handleSessionRestorationErrorInContext(WOContext context) {
		try {
			WOResponse response;
			if (context != null) {
				response = _redirect(context, "sessionExpired"); // -> DirectAction
			} else {
				response = super.handleSessionRestorationErrorInContext(context);
			}
			return response;
		} catch (Throwable t) {
			log.fatal(t.getMessage(), t);
			return super.handleSessionRestorationErrorInContext(context);
		}
	}

	private WOResponse _redirect(WOContext context, String directActionName) {
		WOResponse response;
		NSDictionary<String, ?> params = new NSDictionary<String, Object>(Boolean.FALSE, "wosid");
//		String url = context.directActionURLForActionNamed(directActionName, params);
		String url = ERXWOContext._directActionURL(context, directActionName, params, false);
		if (AjaxUtils.isAjaxRequest(context.request())) {
			response = createResponseInContext(context);
			response.appendContentString("<script>document.location.href='" + url + "';</script>");
		} else {
			WORedirect page = pageWithName(WORedirect.class);
			page.setUrl(url);
			response = page.generateResponse();
		}
		return response;
	}


HTH,

Timo

Am 22.11.2010 um 20:35 schrieb Johnny Miller:

> Hi,
>
> I'm sure this is discussed somewhere but I'm unable to find it.
>
> If a session timeouts between ajax requests how do you handle the response?  I assume it is a combination of WOApplication's handleSessionRestorationErrorInContext and AjaxUtil.isAjaxRequest methods.
>
> Do you just return a javascript method in the response that redirects to a direct action?  I can also see from wocontext that you may be able to triangulate which page the request originated from.
>
> Anyway, any advice would be greatly appreciated!
>
> Johnny Miller
> Kahalawai Media Corp
> http://www.kahalawai.com
>
>
>
> _______________________________________________
> 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

 _______________________________________________
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: Ajax Requests and Session Timeouts
      • From: Johnny Miller <email@hidden>
References: 
 >Ajax Requests and Session Timeouts (From: Johnny Miller <email@hidden>)

  • Prev by Date: Re: Ajax Requests and Session Timeouts
  • Next by Date: Re: ERAttachment... to-many and thumbs
  • Previous by thread: Re: Ajax Requests and Session Timeouts
  • Next by thread: Re: Ajax Requests and Session Timeouts
  • Index(es):
    • Date
    • Thread