tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: authorization providers (was More on JAAS)
Date Thu, 20 Apr 2000 00:05:30 GMT
Costin Manolache wrote:

> > * State Management -- Both RequestInterceptors and Valves are
> >   used in a multithreaded environment (thread per concurrent
> >   request).  As a result, any state about this request that a
> >   RequestInterceptor wants to save must be stored in the request
> >   itself.  In a Valve, you can do that (important if some other
> >   component needs access to this information) but you can also
> >   use local variables inside the invoke() method for state information
> >   that is purely local to this request.
> BTW, how is that working ??? Assuming you have a valve A and
> a valve B, A calling B.invoke() - how can B access the local variables
> in A ?

It cannot, unless you store them someplace more public (like request
attributes).  On the other hand, my view is that most interceptors will be
pretty much independent of other interceptors, so this will be the exception
rather than the rule.

The issue I was addressing is, where do I keep state information specific to
this particular interceptor related to this particular request?  Because
there's only one instance of the interceptor (so you cannot use instance
variables unless you internally key things by thread), and you cannot use
local variables (they go away as each handler method returns) to keep state
information from one handler method to the next handler method in that same

It's not that you cannot store state information for this purpose -- it's
just a little more complicated to have to use something like request
attributes for things that are (from a logical perspective) private to this

> Costin
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message