I'd go with one filter that opens/closes a context early in the filter
chain; not necessarily because of the cost, but just to have the
concern clearly expressed in the system architecture.
Also, if you're doing request forwarding (i.e. from a controller to a
view), you might want to have a single context open for both the
controller action + view rendering.
Attila.
On 2009.01.27., at 16:45, Robert Koberg wrote:
Hi,
Say I have two (maybe more) servlet filters. Each filter executes a
separate script. For example, the first filter does some
authentication/authorization and a second does some business logic.
Is there no to relatively little cost to Context.enter()/exit() in
each filter? Or would it be worthwhile to Context.open() in the
first filter and leave open for the rest of the filter chain and
finally closing when it returns back down the chain, e.g.
What would you do?
Filter1
Context.open()
//auth
next.doFilter(req, res)
Context.exit()
Filter2
if (something) {
res.sendRedirect(...)
Context.exit()
return;
}
// do something
next.doFilter(req, res
thanks,
-Rob
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino