title: Wicket 6.3.0 AjaxLink: IAjaxCallListener behaviour
body: <p>Prior to Wicket 6  the javascript code returned by IAjaxCallDecorator.decorateScipt was executed immediately after a click. I migrated IAjaxCallDecorator according to the <a href="https://cwiki.apache.org/confluence/display/WICKET/Wicket+Ajax" rel="nofollow">migration-guide</a>. 
  By clicking 3 times the link within 5 seconds the expected result is:</p>
  
  <ul>
  <li>getPrecondition</li>
  <li>getPrecondition</li>
  <li>getPrecondition</li>
  <li>getSuccessHandler</li>
  <li>getSuccessHandler</li>
  <li>getSuccessHandler</li>
  </ul>
  
  <p>But the result was:</p>
  
  <ul>
  <li>getPrecondition</li>
  <li>getSuccessHandler</li>
  <li>getPrecondition</li>
  <li>getSuccessHandler</li>
  <li>getPrecondition</li>
  <li>getSuccessHandler</li>
  </ul>
  
  <p>Use case: Blocking until an Ajax request is complete see <a href="http://my.safaribooksonline.com/book/-/9781849511605/deeper-into-ajax/ch07lvl1sec04" rel="nofollow">http://my.safaribooksonline.com/book/-/9781849511605/deeper-into-ajax/ch07lvl1sec04</a> (Page 162)</p>
  
  <p>Is there another way to migrate IAjaxCallDecorator to Wicket 6?</p>
  
  <pre><code>public class HomePage extends WebPage {
  
   public HomePage(final PageParameters parameters) {
    add(new Label("version", getApplication().getFrameworkSettings().getVersion()));
  
    AjaxLink&lt;Void&gt; blockingLink = new AjaxLink&lt;Void&gt;("blockingLink") {
      @Override
      public void onClick(AjaxRequestTarget target) {
        try {
          Thread.sleep(5000);
        } catch (InterruptedException e) {
          e.printStackTrace();
        }
      }
      @Override
      protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
        super.updateAjaxAttributes(attributes);
  
        IAjaxCallListener blockingListener = new AjaxCallListener() {
          @Override
          public CharSequence getPrecondition(Component component) {
            return "console.log('getPrecondition');";
          }
          @Override
          public CharSequence getSuccessHandler(Component component) {
            return "console.log('getSuccessHandler');";
          }
        };
        attributes.getAjaxCallListeners().add(blockingListener);
      }
    };
    add(blockingLink);
   }
  }
  </code></pre>