Hello,

These webwork and xwork doc pages may help:
http://wiki.opensymphony.com/display/XW/Interceptors
http://www.opensymphony.com/webwork/api/com/opensymphony/xwork/ActionInvocation.html
http://www.opensymphony.com/webwork/api/com/opensymphony/xwork/ActionProxy.html

Passed in to your interceptor's intercept method is an ActionInvocation.
This object has a getProxy() method, which returns an ActionProxy.
The ActionProxy has a getMethod() method, which will return the method
name as a String. So you'll need to call those methods and then use
reflection to call your beforeXXX and afterXXX methods.

In your intercept method the invocation.invoke() line is what continues
down the chain of interceptors and finally to the Action's method.
Anything you do before the invocation.invoke() is before the action
execution, anything after invocation.invoke is after the action
execution. It is also after the result execution, so for your case it
seems you'd have to setup the PreResultListener, and put the ActionProxy
method lookup and reflective call bit in there as well.

If you post your Interceptor to the list, that might help also.

Dave



On Tue, 2006-09-26 at 12:11 +0200, Labey Sébastien wrote:
> Hi, I'm new to Struts2 and i don't really understand how does Interceptor 
> technique work. 
> I have made my own interceptor that implements Interceptor interface. I place 
> it in struts.xml with my action. It's OK, before invoking my action, i go 
> through my interceptor in the intercept() method.
> But do all interceptor classes go only through intercept() method or is there 
> a solution to go through another method name? My need is to go through a 
> beforeXXX() method depending on the name of the méthod described in 
> struts.xml for my current navigation.
>  
> My second question is how to go through an interceptor after the action has 
> been executed but before "forwarding" to jsp? I read in documentation that my 
> interceptor has to implements PreResultListener interface, so i made it, but 
> nothing appens. I dont go through the beforeResult() method, neither the 
> intercept() method... Is it possible to have only one interceptor for both 
> the beforeXXX() and the afterXXX() methods?
>  
> All your helps would be great. Thanks in advance
>  
> Sebastien
>  
> 
> Sébastien LABEY
>  
> Division Immobilier
> R&D IKOS
>  
> 04.72.18.47.07
>  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
> 20, chemin du Randin - B1 - 69130 Ecully
> P Avant d'imprimer, ayez une pensée pour notre environnement
> 
> *
> 
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to