You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Steven Yang <ke...@gmail.com> on 2018/12/12 09:26:26 UTC

default interceptor overriding parent package default interceptor

Hi
I have the following setup of my struts2 xml.

in cus.xml
<struts>
   <package name="cus" extends="defaultPackage">
.......no interceptors defined, using interceptors form defaultPackage

in cus-cus.xml
<struts>
   <package name="cus-cus" extends="cus">
   <interceptors>
      <interceptor-stack name="newInterceptorStack">
    ....new interceptors....
      </interceptor-stack>
  <interceptors>
  <default-interceptor-ref name="newInterceptorStack"/>


But all now all the Actions defined in cus.xml uses the newInterceptorStack
as the default interceptor.
I only want the Actions defined in cus-cus.xml to use the
newInterceptorStack as the default interceptor.

Using Struts 2.3.x

Please advice

Thanks

RE: default interceptor overriding parent package default interceptor

Posted by Yasser Zamani <ya...@apache.org>.
Hi Steven,

We have similar config at showcase [1]. I putted a breakpoint at [2]. It works as expected i.e. for "index" action it hits break point as not a first interceptor but for "skill/save" action it hits it as the first interceptor.

Does issue persist with latest Struts 2.3.x version? Could you check with latest 2.5.x version? If in both the issue persists, then you may miss something in your app or checking method.

Regards.

[1] https://github.com/apache/struts/blob/414719171ae14b215537c1c17f8e0e6d34ec5c19/apps/showcase/src/main/resources/struts.xml#L132
[2] https://github.com/apache/struts/blob/414719171ae14b215537c1c17f8e0e6d34ec5c19/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java#L62


>-----Original Message-----
>From: Steven Yang <ke...@gmail.com>
>Sent: Wednesday, December 12, 2018 12:56 PM
>To: Struts Users Mailing List <us...@struts.apache.org>
>Subject: default interceptor overriding parent package default interceptor
>
>Hi
>I have the following setup of my struts2 xml.
>
>in cus.xml
><struts>
>   <package name="cus" extends="defaultPackage"> .......no interceptors defined,
>using interceptors form defaultPackage
>
>in cus-cus.xml
><struts>
>   <package name="cus-cus" extends="cus">
>   <interceptors>
>      <interceptor-stack name="newInterceptorStack">
>    ....new interceptors....
>      </interceptor-stack>
>  <interceptors>
>  <default-interceptor-ref name="newInterceptorStack"/>
>
>
>But all now all the Actions defined in cus.xml uses the newInterceptorStack as the
>default interceptor.
>I only want the Actions defined in cus-cus.xml to use the newInterceptorStack as
>the default interceptor.
>
>Using Struts 2.3.x
>
>Please advice
>
>Thanks

Re: default interceptor overriding parent package default interceptor

Posted by Steven Yang <ke...@gmail.com>.
thanks for the reply

i will look into it more

if problem persists, i will try to put a sample together.

On Mon, Dec 17, 2018 at 10:41 PM Lukasz Lenart <lu...@apache.org>
wrote:

> This is strange, inheritance should work just one way. Can you prepare
> a small Maven based demo to demonstrate this behaviour?
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> śr., 12 gru 2018 o 10:26 Steven Yang <ke...@gmail.com> napisał(a):
> >
> > Hi
> > I have the following setup of my struts2 xml.
> >
> > in cus.xml
> > <struts>
> >    <package name="cus" extends="defaultPackage">
> > .......no interceptors defined, using interceptors form defaultPackage
> >
> > in cus-cus.xml
> > <struts>
> >    <package name="cus-cus" extends="cus">
> >    <interceptors>
> >       <interceptor-stack name="newInterceptorStack">
> >     ....new interceptors....
> >       </interceptor-stack>
> >   <interceptors>
> >   <default-interceptor-ref name="newInterceptorStack"/>
> >
> >
> > But all now all the Actions defined in cus.xml uses the
> newInterceptorStack
> > as the default interceptor.
> > I only want the Actions defined in cus-cus.xml to use the
> > newInterceptorStack as the default interceptor.
> >
> > Using Struts 2.3.x
> >
> > Please advice
> >
> > Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: default interceptor overriding parent package default interceptor

Posted by Lukasz Lenart <lu...@apache.org>.
This is strange, inheritance should work just one way. Can you prepare
a small Maven based demo to demonstrate this behaviour?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

śr., 12 gru 2018 o 10:26 Steven Yang <ke...@gmail.com> napisał(a):
>
> Hi
> I have the following setup of my struts2 xml.
>
> in cus.xml
> <struts>
>    <package name="cus" extends="defaultPackage">
> .......no interceptors defined, using interceptors form defaultPackage
>
> in cus-cus.xml
> <struts>
>    <package name="cus-cus" extends="cus">
>    <interceptors>
>       <interceptor-stack name="newInterceptorStack">
>     ....new interceptors....
>       </interceptor-stack>
>   <interceptors>
>   <default-interceptor-ref name="newInterceptorStack"/>
>
>
> But all now all the Actions defined in cus.xml uses the newInterceptorStack
> as the default interceptor.
> I only want the Actions defined in cus-cus.xml to use the
> newInterceptorStack as the default interceptor.
>
> Using Struts 2.3.x
>
> Please advice
>
> Thanks

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