shiro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan D. Cabrera" <>
Subject Re: Multiple instances of the same Filter class across filter chain definitions
Date Mon, 27 Jun 2011 04:57:41 GMT

On Jun 26, 2011, at 2:09 PM, Les Hazlewood wrote:

> I'd like to resurface Kalle's approach to using multiple instances of
> the same filter class across different matching URL pattern filter
> chains.
> Currently today, the same filter instance is used across multiple
> chains, for example:
> [main]
> # configure 'myFilter' here:
> = bar
> myFilter.blah = whatever
> [urls]
> # use the 'myFilter' in multiple filter chains:
> /some/path/** = myFilter, x, y, z, ...
> /another/path/** = myFilter, a, b, c, ...
> Under Kalle's approach, each path would have its own individual
> instance of the 'myFilter' class, instead of a single instance being
> shared across chains as it is done today.
> Kalle, how do you propose that end-users would configure the
> multi-instance approach in INI?
> For example, objects are typically instantiated and configured in
> [main] and then referenced in [urls].  How would that be different
> with your approach?

For me, I like having the control of creating the instance outside of the filter chain definition.
 Maybe if there's a method in the filter that follows a signature

public Filter allocate();

or is annotated:

public Object fubar();

then the framework could create instances per path.  With the annotation we can be a bit more

public Object fubar();


View raw message