On Wed, Apr 28, 2021 at 10:45 AM Rémy Maucherat <r...@apache.org> wrote:
> On Wed, Apr 28, 2021 at 9:07 AM Mark Thomas <ma...@apache.org> wrote: > >> I'm wondering if there is merit in a Valve-like mechanism for Coyote. >> Name TBD but would look something like: >> - callbacks >> - after request headers are parsed / before the request is prepared >> - after the request is prepared >> - before response headers are prepared >> - after response headers are prepared / before they are written >> - allow multiple "Valves" to be configured >> - provide a "default" that doesn't require explicit config >> - explicit config can add custom "valves", the default "valve" or any >> combination >> > > I thought about it quite a bit in the past, an interceptor [resurrecting > the old name] could be a solution to a lot of problems here. So why not. > Thinking about it some more, I would propose investigating either: - Adding a new interface in addition to ActionHook to coyote.Request, maybe called EventHook (gets a code and the request object). - Allowing more than one ActionHook [the codes include plenty of the interesting events already especially commit, flush]. User configured hooks would be added and called *before* the main coyote hook (obviously). Although this sounds easier to implement, this is tricker and error prone as the call patterns are funky (also the hook field is duplicated between request and response likely for no good reason); basically I would say all hook action calls would now go through a helper method on the Request. - Something else ;) Rémy > > Rémy > > >> >> I'm leaning towards the latter approach as it has much greater >> flexibility and I can see different users having subtly different >> requirements and this avoids an explosion of configuration attributes on >> a single class. >> >> Mark >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: dev-h...@tomcat.apache.org >> >>