This feels a little kludgy, but you can always use a signal that is
reset at some time after the activation. syncLists would then just
check that boolean signal to see if it had already been run.
Alternately, If you have a spring-style prototype scope in your
services (ie, created anew for each injection) then you can move
syncLists into a prototyped service so that it is, itself, a new
instance for each inject. Then syncLists() on that service can call
internal (hidden) signalling to ensure it is only called once per
lifetime.
The latter is a bit of extra infrastructure, but I have often used
prototype-scope to get one-shot behaviour like this. If you have
other need of this same scope, then it can be useful.
Christian.
On 24-Oct-07, at 5:39 AM, Britske wrote:
for a page, I have two activation-methods:
onActivate()
onActivate(Object[] list);
when i provide an activation context to the page both methods are
called
-onactivate() first-.
This seems correct behavior according to some forum-posts i've read.
However, both methods call a method syncLists() which does a pretty
expensive operation (get search results based on the activation
context or
default if no activation context exists).
The problem is that now syncLists() is called twice when the page
has an
activation-context (based on calling both of the onActivate()-
methods).
Obviously this is unwanted.
However, I can't remove syncLists() from onActivate() (without
params),
because a page-access without activation-context should call
syncLists() as
well.
so what i need to do is
a. have onActivate() not called when an activatecontext exists
b. detect in onActivate() that an activationcontext exists and based
on that
not call syncLists().
c. don't have syncLists() updated on onActivate() but on a change of
the
page (so before the "redirect-after-post")
I can't find a way to do A. or B. while C. doesn't seem the best
option,
because a lot of fields (on the page and in components) would need
to be
tagged with @Persist to survive setting them on post and then
redirecting.
Anyone?
Thanks,
Geert-Jan
--
View this message in context:
http://www.nabble.com/-T5-%3A-how-to-prevent-onActivate%28%29-from-firing-with-activationcontext-tf4683298.html#a13382460
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]