struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Molitor, Stephen L" <Stephen.L.Moli...@erac.com>
Subject RE: Intercepting Action Filters
Date Tue, 29 Jul 2003 18:49:46 GMT
Yes, there's a lot of overlap between servlet filters and 'action filters'.  But with a servlet
filter you get control after Struts has already performed the action forward.  With an 'action
filter' you'd get control before the forward is performed, and you would have convenient access
to the mapping, form, etc.  (But I guess you could still fish that stuff out of the request
in a servlet filter.)

You can't wrap a call to a try..catch..finally block with before/AfterExecute hooks.  You
would need that for things like transactions, as you mention.

Steve

-----Original Message-----
From: Jing Zhou [mailto:jing@netspread.com]
Sent: Tuesday, July 29, 2003 10:56 AM
To: Struts Users Mailing List
Subject: Re: Intercepting Action Filters


<snip>
One can do this with servlet filters, but sometimes its nice to do this
within Struts, to look at the action mapping, pick an action forward, etc.
I could imagine libraries of pluggable 'ActionFilters' for checking that the
user is logged in, security, transaction demarcation, logging, etc.
Applications could pick and choose which ones they want, a la carte style.
One could write a request processor that would take a configured list of
these 'filters', build a filter chain, and run them around each
Action.execute invocation.   Has anyone done anything like this?  Any issues
to watch out for?


I would

Thanks.

Steve Molitor

</snip>

I believe that using the request processor to invoke configured *filters*
would overlap too much with the servlet filters. What a real filter
can't do is the transaction demarcation.

Instead of using configurable actions or request processors,
we prefer to use configurable event handling logics inside actions.
You could look at the concept of Control Page in
http://www.netspread.com/tips2.html
When a control page should be shared, we use Controller Delegation
Model. Calls like beforeExecute() or afterExecute() can be done
in such model.

Jing
Netspread Carrier
http://www.netspread.com



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message