Hi Henri, Jesse.
That makes sense too but in this scenario, if you check before the
activateExternalPage is called and lets imagine the user is not allowed,
you
throw a PageRedirectException => the parameters passed to
activateExternalPage become lost. So I really do have a problem with the
logic of this method...
Luckily I haven't had to worry about that yet, but I agree it's a problem.
Still, I'm really just pointing out that this is the way things were done
(mainly by Howard, in his infinite and exponentially increasing wisdom!)
and if the events can be improved without breaking things, I'm all for it!
I can imagine that there is a security risk if you do actions in the
activateExternalPage... Is that what you are doing? I usually only load
page
properties from the parameters so my code there is harmless and in the
worst case it just throws an exception.
This why I mentioned the change in mentality required if the event order
is switched. Obviously the way pageValidate was intended to be used placed
a natural order on the events. My code is harmless too - it decodes params
and might just use an ASO ... Oh! But the ASO might not be valid if the
pageValidate doesn't enforce it, which mine does. We redefine harmless. ;-)
Isn't pageBeginRender called twice with a form? One before rewinding and
once on the rendering?
My code in there is really per page... stuff like set the default
selection.
I think this is the main reason why I moved all my code to
pageValidate... I
got lots of tortured code that with the rewiding checks in my forms so I
moved away from this method.
Sure, this is part of the, ahem, *charm* of pageBeginRender. But it's not
too bad - just an if statement present in every pageBeginRender I write! ;-)
public void pageBeginRender(PageEvent event)
{
// initialize properties etc
if (!event.getRequestCycle().isRewinding())
{
// code almost always goes here ...
}
}
At least with frequent releases this can be solved fast ;-)
Yes indeed - no complaints here with respect to dev activity! ;-)
Some amazing work being done by you guys. Still, the cast of characters
in the dev list seems to have thinned out recently, which is a shame.
Topics like this usually benefit from a few different points of view.
The other option is another listener, but it seems a bit superfluous:
pageAttached
pageValidate - check user is allowed to access page
activateExternalPage - setup here - but only for external pages
+++ pageInitialise - setup here - not called for rewind?
pageBeginRender - setup here - but check for rewind
pageEndRender
pageDetached
Cheers,
Nick.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]