[hunchentoot-devel] Specializing process-request

Frode V. Fjeld frode at netfonds.no
Wed Nov 25 08:42:06 UTC 2009


Hi all,

The Hunchentoot documentation at http://weitz.de/hunchentoot/ mentions
that an around-method on process-request "might be a good place to
introduce around methods which bind special variables or do other
interesting things."

In my eyes there's a problem with this, because the standard
process-request sets up crucial parts of the dynamic environment for
request processing, and around methods can only modify the scope outside
of that. In particluar, error and warning conditions are handled before
the around method gets a chance to intervene.

I would suggest adding a new generic function that does just the
dispatching, i.e. something like this:

  (defmethod dispatch-request ((*request* t))
    (funcall (acceptor-request-dispatcher *acceptor*) *request*))

..and have the kernel of the standard process-request method just call
dispatch-request in the obvious way.

I think this is a more appropriate configuration point for the request
processing protocol than the current process-request is.


(I can/could of course specialize process-request for my acceptor class
using an unqualified method, and thus set up the dynamic environment
just how I want it. However I would then just have to copy the full body
of the standard process-request to insert a line or two inside the body
of the handler-bind. I believe it's the purpose of a processing protocol
to avoid having to do such things.)

-- 
Frode V. Fjeld
Netfonds Bank ASA





More information about the Tbnl-devel mailing list