You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Sven Meier (Jira)" <ji...@apache.org> on 2019/10/16 09:40:00 UTC
[jira] [Commented] (WICKET-6711) Contradictory generating behavior
id in AbstractDefaultAjaxBehavior#onBind for stateless behaviors
[ https://issues.apache.org/jira/browse/WICKET-6711?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16952661#comment-16952661 ]
Sven Meier commented on WICKET-6711:
------------------------------------
That leaves stateless-non-Ajax behaviors which do not require an ID (e.g. an AttributeModifier). I don't see a problem with that.
> Contradictory generating behavior id in AbstractDefaultAjaxBehavior#onBind for stateless behaviors
> --------------------------------------------------------------------------------------------------
>
> Key: WICKET-6711
> URL: https://issues.apache.org/jira/browse/WICKET-6711
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core
> Affects Versions: 8.6.1
> Reporter: David Rain
> Priority: Major
> Labels: ajax, behavior
>
> *Behavior* class says that behavior is not stateless if it is a request listener:
> {code:java}
> public boolean getStatelessHint(Component component) {
> if (this instanceof IRequestListener) {
> // this behavior implements a callback interface, so it cannot be stateless
> return false;
> }
> return true;
> }
> {code}
> In *Behaviors* "util" class the stable ID is generated for NOT stateless (i.e. stateful) behaviors:
> {code:java}
> private void internalAdd(final Behavior behavior) {
> component.data_add(behavior);
> if (behavior.getStatelessHint(component) == false) {
> getBehaviorId(behavior);
> }
> }
> {code}
> BUT in *AbstractDefaultAjaxBehavior*#onBind there is a contradictory piece of code, that generates ID for stateless behaviors:
> {code:java}
> protected void onBind() {
> final Component component = getComponent();
>
> component.setOutputMarkupId(true);
>
> if (getStatelessHint(component)) {
> //generate behavior id
> component.getBehaviorId(this);
> }
> }
> {code}
> The AJAX behaviors are always IRequestListener so they are stateful by default (unless the getStatelessHint is overridden).
> (?) It does not make sense to me... generate ID for stateful behaviors on the one hand in Behaviors and on the other hand for stateless in AbstractDefaultAjaxBehavior.
> (!) I suspect that this could be bug.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)