On Tue, Mar 10, 2009 at 11:28 AM, Edi Weitz edi@agharta.de wrote:
On Tue, Mar 10, 2009 at 7:53 AM, Eric Abrahamsen girzel@gmail.com wrote:
Most often, I'm redefining an existing handler (to expand or correct it) and would rather overwrite that handler with its new version, rather than adding a new entry. I'm finding it awkward to modify my macro so that it checks for an existing handler with that function name and overwrites it – more importantly I'm not certain this is the best way to do it.
DEFINE-EASY-HANDLER should overwrite existing handlers of the same name (or if they have the same - EQUAL - URI part). If it doesn't do that, it's a bug.
Maybe he is referring to the fact, that after redefining the DISPATCHER, the running server's dispatch table remains unchanged. In the sense, that the server continues to use the dispatcher closures, created at the time of the server start. At least for me it works this way (in old Hunchentoot): when I redefine a dispatcher, I need to modify the dispatch table (or plainly restart the server) for the change to take effect.
To clarify, I'd like to add, that I refer to the handler functions as per the docs (e.g. html-generation functions). They take no arguments and are responsible for forming the reply object. If you redefine them, it has immediate effect. Dispatchers are the closures in the dispatch-table, that take 1 argument -- request. If you redefine the dispatcher (for example, with define-easy-handler, or manually), somehow, it doesn't effect the running server's dispatch-table.