On Wed, 25 Mar 2015 21:54:07 +0100, Sönke Ludwig wrote:

Am 25.03.2015 um 21:22 schrieb Marc Schütz:

Is it possible to attach a @before or @after handler to all exposed
methods of a router interface? Better yet, even including all sub
routers?

Such a handler would need to be a template so it can fit all method
signatures.

Not directly possible currently. The question is if this would better be
a feature supported by the interface generator, or maybe a general
transformation feature that takes a class as input an outputs a class
that has all function calls properly augmented (with attributes or
directly with code). Could be something for std.functional.

At least for certain use cases, just intercepting the HTTP request and
possibly storing some values in req.params can be a viable alternative
(or, similarly, intercepting the response in case of a
RestInterfaceClient).

Now that 2.067 is out, I will resume my work on the new REST generator. That's definitely something that could fit in.
Do you need the attributed parameter in addition, or do you just want to do some kind of check (like isAuthenticated) ?