wicket 1.4.9 When a wicket behavior tries to load a javascript resource from the response, I want to create some error handler (a javascript alert) that runs if the javascript package resource is not found.
I set an IAjaxCallDecorator which spits out a javascript string on failure, but the failure decoration isn't being used in the case where the script resource returns a 404. My link: return new AjaxFallbackLink(linkId) { protected IAjaxCallDecorator getAjaxCallDecorator() { CompositeAjaxCallDecorator decorator = new CompositeAjaxCallDecorator(); decorator.setFailureDecorator(new SimpleScriptDecorator( "alert('An error occurred communicating with the server. Please contact a system administrator.');")); return decorator; } ... }; I can see that my CompositeAjaxCallDecorator generates the event handler correctly in the output, so I'm not going to post the code for that class. The output: <a onclick="var wcall=wicketAjaxGet('../?wicket:interface=:6:contentPanel:tabPanel:tabs-container:tabs:1:link::IBehaviorListener:0:1',function() { }.bind(this),function() { alert('An error occurred communicating with the server. Please contact an AIMS administrator.');}.bind(this), function() {return Wicket.$('link49c') != null;}.bind(this));return !wcall;" id="link49c" href="../?wicket:interface=:6:contentPanel:tabPanel:tabs-container:tabs:1:link::ILinkListener::"><span>Import</span></a> When I click on the link, the wicket ajax debug shows: INFO: Initiating Ajax GET request on ../resources/com.csc.aims.wicket.behaviors.calldecorator.ClearFeedbackScriptDecorator/ClearFeedbackScriptDecorator.js INFO: Invoking pre-call handler(s)... INFO: focus removed from link49c ERROR: Received Ajax response with code: 404 INFO: Invoking post-call handler(s)... INFO: Invoking failure handler(s)... INFO: focus set on link49c INFO: focus removed from link49c I did some debugging, and noticed that in wicket-ajax.js, the script element is loaded from the response using a second ajax request: 1613 // we need to schedule the request as timeout 1614 // calling xml http request from another request call stack doesn't work 1615 window.setTimeout(function() { 1616 var req = new Wicket.Ajax.Request(src, onLoad, false, false); 1617 req.debugContent = false; 1618 if (Wicket.Browser.isKHTML()) 1619 // konqueror can't process the ajax response asynchronously, therefore the 1620 // javascript loading must be also synchronous 1621 req.async = false; 1622 // get the javascript 1623 req.get(); 1624 },1); This second ajax request doesn't specify a failure handler, so I'm thinking that he's the culprit. How can I fix this? Thanks, ________________________________ RUSSELL E. MORRISEY Programmer Analyst Professional Mission Solutions Engineering, LLC | russell.morri...@missionse.com | www.missionse.com<http://www.missionse.com/> 304 West Route 38, Moorestown, NJ 08057-3212 ________________________________ This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind MSE to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose.