Export to GitHub

gwt-dispatch - issue #3

Separate Dispatch initialization from ActionHandler initialization


Posted on Jul 7, 2009 by Grumpy Rhino

Currently, action handlers are registered in the 'configureHandlers' method of ServerDispatchModule. A static boolean is used to ensure that if more than one instance of ServerDispatchModule is created, only one Dispatch is bound. However, if there are multiple injectors, this strategy will fail.

A better way is similar to the guice-servlet extension, where is has a separate module with equals/hashCode overriden to always match any instance of the module. This prevents duplicates being bound nicely.

However, the names of the default modules don't really make sense once that functionality is made separate. ServerDispatchModule now just installs the standard bindings, and the new ActionHandlerModule should be subclassed to register handler bindings. You can skip binding ServerDispatchModule if you're happy with the defaults.

Also, this allows for custom implementations of Dispatch and ActionHandlerRegistry to be specified by simply creating a ServerDispatchModule and providing custom classes prior to any ActionHandlerModules being installed.

Comment #1

Posted on Jul 7, 2009 by Grumpy Rhino

(No comment was entered for this change.)

Comment #2

Posted on Oct 21, 2009 by Grumpy Rhino

(No comment was entered for this change.)

Status: Done

Labels:
Type-Defect Priority-Medium Milestone-Release1.0