DWR

Override global Remoting Hooks with preHook or postHook on a per-call basis does not work

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Normal Normal
  • Resolution: Unresolved
  • Affects Version/s: 3.0.RC2
  • Fix Version/s: 3.0.RC4
  • Component/s: None
  • Documentation Required:
    No
  • Description:
    Hide
    globally defined Remoting Hooks (works fine):
     dwr.engine.setPreHook(function() {
         startBlockUI();
     });
     dwr.engine.setPostHook(function() {
         stopBlockUI();
     });

    Should be overridden for this call:
    ServerDAO.fetchArray({
             callback:function(arr) {
                ... code ....
             },
             preHook:function() {
             $("#somediv").block();
             },
             postHook:function() {
             $("#somediv").unblock();
             }
     });

    Problem:
    Both Hooks (global and call-basis) are executed.
    Show
    globally defined Remoting Hooks (works fine):  dwr.engine.setPreHook(function() {      startBlockUI();  });  dwr.engine.setPostHook(function() {      stopBlockUI();  }); Should be overridden for this call: ServerDAO.fetchArray({          callback:function(arr) {             ... code ....          },          preHook:function() {          $("#somediv").block();          },          postHook:function() {          $("#somediv").unblock();          }  }); Problem: Both Hooks (global and call-basis) are executed.

Activity

Hide
Martin added a comment - 27/Feb/12 12:25 AM
Show
Martin added a comment - 27/Feb/12 12:25 AM see also the mailing list: http://java.net/projects/dwr/lists/users/archive/2012-02/message/95
Hide
David Marginian added a comment - 09/Sep/12 8:47 PM

Mike, do you know the history of this? We are doing this by design but I am not sure if there is a reason for it, or if it is a mistake. In dwr.engine.batch.create we are pushing the global pre/post hooks into the batch level pre/post hooks.

Show
David Marginian added a comment - 09/Sep/12 8:47 PM Mike, do you know the history of this? We are doing this by design but I am not sure if there is a reason for it, or if it is a mistake. In dwr.engine.batch.create we are pushing the global pre/post hooks into the batch level pre/post hooks.
Hide
David Marginian added a comment - 09/Sep/12 8:48 PM

Assigning to you for a comment.

Show
David Marginian added a comment - 09/Sep/12 8:48 PM Assigning to you for a comment.
Hide
Mike Wilson added a comment - 10/Sep/12 3:33 AM

The most recent discussion I remember was a long time ago when I proposed some changes on the mailing list (see: [dwr-users] call handlers not used, http://dwr.2114559.n2.nabble.com/call-handlers-not-used-td5397136.html#a5397148)

I think we agreed on that global handlers should be overridden by more specific handlers (but as you can see in example 2 in the referred post there may be tricky corner-cases), and I think some of this may not have been adjusted from the old model yet.
On the other hand - our docs at:
http://directwebremoting.org/dwr/documentation/browser/engine/index.html
say that "2 of the options, preHook and postHook, are additive, that is you can have multiple hooks per call. The global preHook is called before the batch and call preHooks. The global postHook is called after the call and batch postHooks."

Traditionally pre/postHook has been used to pop up/down blocking wait messages, so that could be a reason that you want to always catch them independent on if more specific handlers are available.
So the question is really if maybe there are two kinds of global handler settings: global and global default. A global handler would always trigger, independent of handlers on call or batch level, while a global default would only trigger if not overridden on a more detailed level.

Show
Mike Wilson added a comment - 10/Sep/12 3:33 AM The most recent discussion I remember was a long time ago when I proposed some changes on the mailing list (see: [dwr-users] call handlers not used, http://dwr.2114559.n2.nabble.com/call-handlers-not-used-td5397136.html#a5397148) I think we agreed on that global handlers should be overridden by more specific handlers (but as you can see in example 2 in the referred post there may be tricky corner-cases), and I think some of this may not have been adjusted from the old model yet. On the other hand - our docs at: http://directwebremoting.org/dwr/documentation/browser/engine/index.html say that "2 of the options, preHook and postHook, are additive, that is you can have multiple hooks per call. The global preHook is called before the batch and call preHooks. The global postHook is called after the call and batch postHooks." Traditionally pre/postHook has been used to pop up/down blocking wait messages, so that could be a reason that you want to always catch them independent on if more specific handlers are available. So the question is really if maybe there are two kinds of global handler settings: global and global default. A global handler would always trigger, independent of handlers on call or batch level, while a global default would only trigger if not overridden on a more detailed level.

People

Dates

  • Created:
    27/Feb/12 12:23 AM
    Updated:
    29/Nov/12 4:03 PM