struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Huber <gregh3...@gmail.com>
Subject Re: beta3 testing
Date Sun, 06 Mar 2016 13:19:29 GMT
I am kind of getting a bit confused with this now, can we confirm we are
talking
 about the same thing.

>From the docs

https://struts.apache.org/docs/message-store-interceptor.html

It does suggest that you need to add the defaultStack

<action name="submitApplication" ...>
    <interceptor-ref name="store"/>
        <param name="operationMode">STORE</param>
    </interceptor-ref>
    <interceptor-ref name="defaultStack" />
    ....
</action>

(although the last example for the store does not include the default
stack.)

So you are saying that it should default to my

<default-interceptor-ref name="myStack" />

rather than the struts-default ?


If this is the case this is maybe where it seems to happen :

In  DefaultActionInvocation invoke()

if (interceptors.hasNext()) {
                final InterceptorMapping interceptor = interceptors.next();
                String interceptorMsg = "interceptor: " +
interceptor.getName();
                UtilTimerStack.push(interceptorMsg);
                try {
                    resultCode =
interceptor.getInterceptor().intercept(DefaultActionInvocation.this);
                } finally {
                    UtilTimerStack.pop(interceptorMsg);
                }
            } else {
                resultCode = invokeActionOnly();
            }


interceptor.getInterceptor().intercept(DefaultActionInvocation.this);


This is where it actually where seems it decides on what to call.

If there is ONLY the message store it calls struts-default, but if it has
the default myStack interceptors it calls myStack and it will call the
myPrepare?

Sorry if its not too clear????





On 6 March 2016 at 12:23, Lukasz Lenart <lukaszlenart@apache.org> wrote:

> 2016-03-06 12:48 GMT+01:00 Greg Huber <gregh3269@gmail.com>:
> > In DefaultConfiguration.buildFullActionConfig(..) it checks for the
> > interceptors that were added and if it does not find any it adds the
> > getFullDefaultInterceptorRef() which in my case is myStack.
> >
> > I guess the question is whether adding the message store interceptor ever
> > included the default-interceptor-ref?  The code suggests that adding
> > myStack is now required (unless catered for elsewhere).
>
> Nope and it was that way from the very beginning, my refactoring
> didn't change that. I was debugging it early and using just
> MessageStoreInterceptor (with createSession interceptor) shows only
> those two interceptors in scope of the action.
>
> > List<InterceptorMapping> interceptors = new
> > ArrayList<>(baseConfig.getInterceptors());
> > if (interceptors.size() <= 0) {
> >    String defaultInterceptorRefName =
> > packageContext.getFullDefaultInterceptorRef();
> >    if (defaultInterceptorRefName != null) {
> >
> > interceptors.addAll(InterceptorBuilder.constructInterceptorReference(new
> > PackageConfig.Builder(packageContext), defaultInterceptorRefName,
> >                         new LinkedHashMap<String, String>(),
> > packageContext.getLocation(), objectFactory));
> >   }
> > }
>
> Yap, default-interceptor-ref will be used if no other stack was
> defined for an action.
>
>
> Regards
> --
> Ɓukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message