Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-4661

Ajax channel busy flag not properly cleared upon SUCCESSFUL callback executions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 6.0.0-beta3
    • 6.0.0
    • wicket
    • None

    Description

      The error is triggered if a custom AjaxChannel is defined using code like this in an AjaxEventbehavior:

      @Override
               protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
                      super.updateAjaxAttributes(attributes);
                      attributes.setChannel(new AjaxChannel("mychannel", Type.DROP));
               }
      
      

      Note: The channel type does NOT matter. Neither DROP nor QUEUE work.

      My guess is, the fact the a named ajax channel is used results in the client side re-using the JavaScript Wicket.Channel instances.

      In a re-used instance, the busy flag needs to be properly cleared after successfully executing an ajax call and its callback which is NOT done in the currently implemented code:

      schedule: function (callback) {
      			if (this.busy === false) {
      				this.busy = true;
      				try {
      					return callback();
      				} catch (exception) {
      					this.busy = false;
      					Wicket.Log.error("An error occurred while executing Ajax request:" + exception);
      				}
      			} else {
      				Wicket.Log.info("Channel busy - postponing...");
      

      A better, working solution would be:

      schedule: function (callback) {
      			if (this.busy === false) {
      				this.busy = true;
      				try {
      					var callbackResult = callback();
      					this.busy = false;
      					return callbackResult;
      				} catch (exception) {
      					this.busy = false;
      					Wicket.Log.error("An error occurred while executing Ajax request:" + exception);
      				}
      			} else {
      				Wicket.Log.info("Channel busy - postponing...");
      

      Attachments

        1. wicket-4661.patch
          1.0 kB
          Jan Riehn

        Activity

          People

            svenmeier Sven Meier
            coldiges Christian Oldiges
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: