Hello

I have a resourcelink where I need to add an ajaxcallback to recalculate and 
update the current panel.
I added an AbstractDefaultAjaxBehavior to that link with the callback, but the 
respond method was never invoked.
In the wicket ajax debug i saw the following input:

*INFO: *Using XMLHttpRequest transport

*INFO: *

*INFO: *Initiating Ajax GET request on 
?wicket:interface=:0:middle:link::IActivePageBehaviorListener:0:&wicket:ignoreIfNotActive=true&foo=bar&random=0.6376184095942993

*INFO: *Invoking pre-call handler(s)...

*INFO: *Received ajax response (0 characters)

*INFO: *

*ERROR: *Wicket.Ajax.Call.failure: Error while parsing response: Could not find root 
<ajax-response> element

*INFO: *Invoking post-call handler(s)...

*INFO: *Invoking failure handler(s)...

behavior:

final AbstractDefaultAjaxBehavior behave =new AbstractDefaultAjaxBehavior()
   {
     @Override
     protected void respond(AjaxRequestTarget arg0)
     {
       log.debug("respond called");
       repaint();
       arg0.addComponent(self);
     }
     @Override
     protected void onComponentTag(ComponentTag tag)
     {
       super.onComponentTag(tag);
       log.debug("on componenttag called");
       String javascript = "wicketAjaxGet('" + getCallbackUrl()
         + "&foo=bar', function() { }, function() { });";
       tag.put("onClick", javascript);
     }
   };

resourcelink:
add(link = new ResourceLink<Void>("link", new DynamicWebResource()
   {
     @Override
     protected void setHeaders(WebResponse response)
     {
       super.setHeaders(response);
       response.setAttachmentHeader("auszug.zip");
     }

     @Override
     protected ResourceState getResourceState()
     {
       return new ResourceState()
       {
         byte[] data;

         @Override
         public byte[] getData()
         {
           if (data == null)
           {
             try
             {
               data = builderservice.getDataAsZip(rawdata);
               log.debug("length of data: "+data.length);
             } catch (SystemException e)
             {
               log.fatal("systemexception occured", e);
             }
           }
           return data;
         }
         @Override
         public String getContentType()
         {
           return "application/zip";
         }
       };
     }
   })
   );
   link.add(new Label("label", new 
ResourceModel("middle.mailbox.download.all")));
   link.add(behave);

html (as it appears in the browser):

</form>
        <a id="link5e" href="?wicket:interface=:0:middle:link::IResourceListener:: 
<view-source:http://localhost:8080/postfach/?wicket:interface=:0:middle:link::IResourceListener::>" 
onclick="wicketAjaxGet('?wicket:interface=:0:middle:link::IActivePageBehaviorListener:0:&wicket:ignoreIfNotActive=true', function() { 
}, function() { });"><span>Alle Dokumente herunterladen</span></a>
</div></td>
        <td></td></tr>
        </table>
                </td></tr></table></td><td>&nbsp;</td></tr></table>
</body>
</html>

Any ideas to how to solve this problem?

greetings


thierry


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to