Hi Stefano,

This looks like an awkward design as you would go through half the
interceptor stack expecting to call one action, and half the stack expecting
to call a second action.

As an alternative could you do something like the following:-

Create class (or Interface) ReceivingAction with sub classes as the
"actions" you want to assign dynamically.

Create a true action class ForwardingAction with a property ReceivingAction.

The interceptor can now dynamically create the class required (derived from
/ implementing ReceivingAction) and set it on the current action
(ForwardingAction). It could also place the ReceivingAction instance on the
ValueStack.

The main action methods you are interested in (e.g. execute) could simply
forward to the ReceivingAction instance. You will need to be careful about
interceptor order if you want to do things like set your parameter values on
your ReceivingAction.

I haven't implemented this myself, although I have implemented all the
techniques I have described. I'm fairly confident that this will achieve
what you want.

Cheers,

Steve

-----Original Message-----
From: Stefano Corallo [mailto:stefan...@gmail.com] 
Sent: 27 May 2009 07:54
To: user@struts.apache.org
Subject: Struts2 Interceptor

Hi all,

can an interceptor call an arbitraty action different from the action
requested by the client?

Suppose i've the interceptor "interceptor-router" placed in the stack and
the client call MyAction.action, when the interceptor intercept the call is
possible to 'redirect' the call to MyDifferentAction.action from the
interceptor?

I've seen that there is action chaining but this require to know at build
time the name of the actions i want to redirect to, but i know the name only
at runtime and


I hope i was clear :) sorry for my english.


--
Stefano Corallo


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

Reply via email to