Hi,

I wasn't aware of that class and that usage of that method.

First of all returning true from #canCallListener() might open security problems, because a browser might request disabled or invisible components - don't do this if you don't need to.

So I'm wondering how I'm making sure to only return "true" in that
call if AnnotationEventDispatcher is the caller?

I don't see how that would be possible :/.

Actually you could argue whether it is practical that these events are not 
delivered to invisible or disabled components by default - something I wouldn't 
expect, since it requires to override #canCallListener() or a clever solution 
like yours.

IMHO we should make this configurable - calling #canCallListener() without 
method argument isn't helpful but rather dangerous (see above).

Sven


On 01.10.19 19:32, Thorsten Schöning wrote:
Guten Tag Sven Meier,
am Dienstag, 1. Oktober 2019 um 18:51 schrieben Sie:

What methods are you iterating over in onEventMethods?
That's not me, but AnotationEventDispatcher:

https://github.com/wicketstuff/core/blob/master/annotationeventdispatcher-parent/annotationeventdispatcher/src/main/java/org/wicketstuff/event/annotation/AnnotationEventSink.java#L138

That is getting all methods annottated with "@OnEvent" and afterwards
checking if the parent component of those methods is able to get
events by calling "canCallListener" on the component:

https://github.com/wicketstuff/core/blob/master/annotationeventdispatcher-parent/annotationeventdispatcher/src/main/java/org/wicketstuff/event/annotation/AnnotationEventSink.java#L187

The former implementation in Wicket 7 provided the method found during
that call, so the component was able to recognize that
AnnotationEventDispatcher is the caller. That is no longer possible,
because the "Method" argument has been removed in WICKET-6137.

So I'm wondering how I'm making sure to only return "true" in that
call if AnnotationEventDispatcher is the caller? Or if I even need to
at all?

The docs for "canCallListener" read so that one should take extra care
to not easily return "true" without good reasons to do so. And my
reason only is AnnotationEventDispatcher forwarding some event I
depend on even if the component is still invisible.

Mit freundlichen Grüßen,

Thorsten Schöning

Reply via email to