Re: Ajax request, ERXRedirect and ERXThreadStorage
On Jul 12, 2016, at 8:52 AM, Paul Hoadleywrote: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 Hoadleyhttp://logicsquad.net/ ___Do not post admin requests to the list. They will be ignored.Webobjects-dev mailing list (Webobjects-dev@lists.apple.com)Help/Unsubscribe/Update your Subscription:https://lists.apple.com/mailman/options/webobjects-dev/jean_francois_veillette%40yahoo.caThis email sent to jean_francois_veille...@yahoo.ca ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Ajax request, ERXRedirect and ERXThreadStorage
On 13 Jul 2016, at 1:28 AM, Lon Varscsakwrote: > I believe the the thread storage is reset for each request, and the Ajax > request and the redirect are two different requests. That would explain it. Thanks Lon. -- Paul Hoadley http://logicsquad.net/ ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Ajax request, ERXRedirect and ERXThreadStorage
On 13 Jul 2016, at 1:41 AM, Chuck Hillwrote: > As long as you have more than one worker thread, there is no guarantee which > will process which request. I logged out the thread names, and that didn’t seem to be the problem. The same worker thread was involved from the Ajax action through to sending out the re-direct. > Do you have a session you can stash it in? Yeah, that’s my workaround. It’s awkward, though, because the single R-R lifespan of ERXThreadStorage is just perfect for this use case. In fact, I end up moving the informational messages into ERXThreadStorage at some point just to ensure they disappear at the right time (because they shouldn’t persist into the next R-R, they’re just for one-off display). I couldn’t seem to simulate it just using the session. -- Paul Hoadley http://logicsquad.net/ ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Ajax request, ERXRedirect and ERXThreadStorage
As long as you have more than one worker thread, there is no guarantee which will process which request. Do you have a session you can stash it in? Chuck From: <webobjects-dev-bounces+chill=gevityinc@lists.apple.com> on behalf of Lon Varscsak <lon.varsc...@gmail.com> Date: Tuesday, July 12, 2016 at 8:58 AM To: Paul Hoadley <pa...@logicsquad.net> Cc: WebObjects-Dev <webobjects-dev@lists.apple.com> Subject: Re: Ajax request, ERXRedirect and ERXThreadStorage I believe the the thread storage is reset for each request, and the Ajax request and the redirect are two different requests. On Mon, Jul 11, 2016 at 11:52 PM, Paul Hoadley <pa...@logicsquad.net<mailto:pa...@logicsquad.net>> 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? Is the invocation of the action method by the Ajax submission on a different thread? -- Paul Hoadley http://logicsquad.net/ ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com<mailto:Webobjects-dev@lists.apple.com>) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/lon.varscsak%40gmail.com This email sent to lon.varsc...@gmail.com<mailto:lon.varsc...@gmail.com> ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Ajax request, ERXRedirect and ERXThreadStorage
I believe the the thread storage is reset for each request, and the Ajax request and the redirect are two different requests. On Mon, Jul 11, 2016 at 11:52 PM, Paul Hoadleywrote: > 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? Is the invocation > of the action method by the Ajax submission on a different thread? > > > -- > Paul Hoadley > http://logicsquad.net/ > > > > > ___ > Do not post admin requests to the list. They will be ignored. > Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) > Help/Unsubscribe/Update your Subscription: > > https://lists.apple.com/mailman/options/webobjects-dev/lon.varscsak%40gmail.com > > This email sent to lon.varsc...@gmail.com > ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Ajax request, ERXRedirect and ERXThreadStorage
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? Is the invocation of the action method by the Ajax submission on a different thread? -- Paul Hoadley http://logicsquad.net/ ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com