tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: Interceptors
Date Fri, 19 Jan 2001 00:28:16 GMT
Peter Donald wrote:

> [snip]
> I am not saying that Catalinas concept of a valve is completely correct (it
> uses the Anti-Pattern Subvertion of Control - yuck !!) but it is definetly
> a step in the right direction. Personally if I was doing it then I would
> implement Inversion of Control and your valve interface would be as simple
> as below but I think Valves as they exist are a step forward thou YMMV.
>
> public interface Valve {
>   public void invoke(ValveContext context, Request request, Response response)
>       throws IOException, ServletException;
> }
>
> public class MyValve implements Valve {
>   public void invoke(ValveContext context, Request request, Response response)
>       throws IOException, ServletException
>   {
>     ...do stuff with request...
>     context.invokeNext( request, response );
>     ...dostuff with response...
>   }
> }
>

If you change the names and parameter orders a little, you have just quoted the
new api for javax.servlet.Filter in the 2.3 Proposed Final Draft.

I'd be game to change the Valve APIs to conform to this kind of pattern in a 4.1
timeframe, if people prefer it.  If we're ever going to do this, earlier is better
(before too many valves that have to be changed get created).

>
> Cheers,
>
> Pete
>

Craig



Mime
View raw message