Links: 10-17-2006

DWR Callback rules

If you’ve spent time with DWR, you’ve probably seen both the callback function as last parameter idiom and callback function as first parameter idiom and wondered, wtf? The rules for when each one is applicable are below:

  • If there is a function first or last then this is the callback function, there is no call meta-data object and the other parameters are the Java args.
  • Otherwise, if the last param is an object with a callback member that is a function then this is call meta-data the other params are Java args.
  • Otherwise, if the first parameter is null we assume that there is no callback function and the remaining params are Java args. HOWEVER we check to see that the last param is not null and give a warning if it is.
  • Finally if the last param is null, then there is no callback function.
  • Otherwise, this is a badly formatted request – signal an error.


Links: 10-5-2006

Links: 9-30-2006