• 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 request, ERXRedirect and ERXThreadStorage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ajax request, ERXRedirect and ERXThreadStorage


  • Subject: Re: Ajax request, ERXRedirect and ERXThreadStorage
  • From: Jean-François Veillette <email@hidden>
  • Date: Tue, 12 Jul 2016 16:45:54 +0200


On Jul 12, 2016, at 8:52 AM, Paul Hoadley <email@hidden> wrote:

Hello,

I’m working on an app where some page-level informational messages (such as validation problems) are stored in ERXThreadStorage, and displayed by the page wrapper. This works great for full page loads.

In a few places, I’m doing some Ajax submissions with AjaxSubmitButton. In the usual case, nothing goes wrong and an AjaxUpdateContainer displays some new information. I figured that a reasonable way to display validation errors from these Ajax submissions would be to stash the messages in ERXThreadStorage in the usual way, and then use ERXRedirect and its setComponentToPage() to just force a full page reload. This all works except (critically) the _retrieval_ of the messages from ERXThreadStorage—there’s nothing there. Is this expected?

It is expected.  The redirect is in fact a new request sent from the browser, it gets queued and processes by a different thread.  Even if you are lucky and get the same thread, the thread storage dictionary info will be fresh and empty (as for any new request).

Is the invocation of the action method by the Ajax submission on a different thread?

Yes, and with that pattern, the validation information is no longer thread bound but is now multi-request (imagine .css, .js or .jpg requests) bound … or simply session bound.
Maybe you can keep it in a « session’s last request validation info object » and clear it at the start of a full-page request.

jfv

-- 
Paul Hoadley
http://logicsquad.net/


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
References: 
 >Ajax request, ERXRedirect and ERXThreadStorage (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Re: Summary of the State of the Community
  • Next by Date: the wiki
  • Previous by thread: Re: Ajax request, ERXRedirect and ERXThreadStorage
  • Next by thread: webobjects with maven
  • Index(es):
    • Date
    • Thread