Re: Confused by Result-generation

2008-10-21 Thread Stephan Schröder

Ok, i found the answer with debugging
DefaultActionInvocation.invoke()-method. It's the first case even if one
interceptor doesn't call actionInvocation.invoke(). In that case the result
is generated surrounded by all of the previous interceptors.

If all (e.g.2) interceptors call actionInvocation.invoke() you get this
call-sequence: 
Interceptor 1-> Interceptor 2-> Action-> Result-> Interceptor 2->
Interceptor 1

If one (e.g. the second) interceptor doesn't call actionInvocation.invoke()
you get:
Interceptor 1-> Interceptor 2-> Result-> Interceptor 1

There's some tricky use of recursion.

Regards,
Stephan


Stephan Schröder wrote:
> 
> hi,
> 
> as far as i understand it, the calling sequenze of an action mapping looks
> like this:
> Interceptor 1-> Interceptor 2->...-> Action-> Result->...-> Interceptor
> 2-> Interceptor 1
> (see http://struts.apache.org/2.0.11.2/docs/big-picture.html)
> 
> But what happens when i use this AuthenticationInterceptor:
> 
> public class AuthenticationInterceptor extends AbstractInterceptor {
> 
>   public String intercept( ActionInvocation actionInvocation ) throws
> Exception
>   {
> Map session = actionInvocation.getInvocationContext().getSession();
> User user = (User) session.get( Struts2PortfolioConstants.USER );
> if (user == null) {
>   return Action.LOGIN;
> }
> else {
>   (( UserAwareAction ) actionInvocation.getAction()).setUser(user);
>   return actionInvocation.invoke();
> }
>   }
> 
> }
> This is adapted from "Struts 2 in Action" and it looks like here the
> calling sequence would be
> Interceptor 1-> AuthenticationInterceptor-> Interceptor 1-> Result
> 
> So in the normal case the Result is generated within the Interceptors
> while the second code suggests that the Result is generated aber the last
> Interceptor has returned.
> Or is both true?
> 
> Regards,
> Stephan 
> 

-- 
View this message in context: 
http://www.nabble.com/Confused-by-Result-generation-tp20067494p20088687.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Confused by Result-generation

2008-10-20 Thread Stephan Schröder

hi,

as far as i understand it, the calling sequenze of an action mapping looks
like this:
Interceptor 1-> Interceptor 2->...-> Action-> Result->...-> Interceptor 2->
Interceptor 1
(see http://struts.apache.org/2.0.11.2/docs/big-picture.html)

But what happens when i use this AuthenticationInterceptor:

public class AuthenticationInterceptor extends AbstractInterceptor {

  public String intercept( ActionInvocation actionInvocation ) throws
Exception
  {
Map session = actionInvocation.getInvocationContext().getSession();
User user = (User) session.get( Struts2PortfolioConstants.USER );
if (user == null) {
  return Action.LOGIN;
}
else {
  (( UserAwareAction ) actionInvocation.getAction()).setUser(user);
  return actionInvocation.invoke();
}
  }

}
This is adapted from "Struts 2 in Action" and it looks like here the calling
sequence would be
Interceptor 1-> AuthenticationInterceptor-> Interceptor 1-> Result

So in the normal case the Result is generated within the Interceptors while
the second code suggests that the Result is generated aber the last
Interceptor has returned.
Or is both true?

Regards,
Stephan
-- 
View this message in context: 
http://www.nabble.com/Confused-by-Result-generation-tp20067494p20067494.html
Sent from the Struts - User mailing list archive at Nabble.com.


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