You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Thomas Lionel SMETS (prof)" <ts...@a3-system.eu> on 2013/08/27 13:07:20 UTC

Interceptor in various struts.xml

I created my interceptor stack in the top-level struts.xml, like this :
<!DOCTYPE struts PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
  "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>

    <package name="default" namespace="/" extends="struts-default">

        <interceptors>
            <interceptor name="logging"
class="com.mysite.common.MdcLoggingUtility"/>
            <interceptor-stack name="MyStack">
                <interceptor-ref name="params">
                    <param name="acceptParamNames">^[a-zA-Z0-9_]+$</param>
                    <param name="paramNameMaxLength">40</param>
                </interceptor-ref>
                <interceptor-ref name="timer" >
                    <param name="logLevel">info</param>
                </interceptor-ref>   
                <interceptor-ref name="defaultStack" />
            </interceptor-stack>
        </interceptors>

        <default-interceptor-ref name="MyStack" />
       
...

    <include file="module_1/struts.xml" />
    <include file="module_2/struts.xml" />
</struts>


I have tried different declaration in the submodules but thay all seems
to not thoroughly work.
So having the same declaration or the same declaration with different
name for the interceptor or using "MyStack" in the extends ...


Any idea would be appreaciated.

Tx,











-- 
Thomas Lionel SMETS, CISSP (385434)
*m :* +32 497 44 68 12
*ph :* +32 2 852 3341
*skype :* thomas.lionel.smets

PGP = FDF0 8FB8 4F37 3F79 1011 05AB 0DCE 9BAB 5DD0 0E10

Re: Interceptor in various struts.xml

Posted by Ken McWilliams <ke...@gmail.com>.
To be clear, the term "submodule" to me indicates some type of
encapsulation... you know that the includes only make one big XML file? If
this is a new project consider the struts2-conventions-plugin, if it is in
use I don't think your configuration should need to grow beyond more than
one xml file.


On Tue, Aug 27, 2013 at 8:00 AM, Dave Newton <da...@gmail.com> wrote:

> Are the actions in the same package?
>
> You need to provide more information; we cannot see your project and
> without specifics, we have to guess.
>
> Dave
>
>
>
> On Tue, Aug 27, 2013 at 9:30 AM, Thomas Lionel SMETS (prof) <
> tsmets@a3-system.eu> wrote:
>
> >  Typically, MdcLoggingUtility does this :
> >
> >    @Override
> >     public String intercept(ActionInvocation invocation) throws Exception
> > {
> >         /*
> >          * This code puts a unique Id to the Mapped Diagnostic
> >          * context. Since MDC is a static class, we can directly access
> it
> >          * with out creating a new object from it.
> >          */
> >         String uniqueId =
> > UniqueIdGenerator.generateId(Constants.MAX_UNIQUE_ID_LENGTH);
> >         MDC.put(LoggingConstant.TRANSACTION_ID, uniqueId);
> >         if(LOG.isInfoEnabled())
> >             LOG.info("Putting a unique ID in the context : " + uniqueId);
> >         String invocationResponse = invocation.invoke();
> >         if(LOG.isInfoEnabled())
> >             LOG.info("Removing unique ID from the context : " +
> > MDC.get(LoggingConstant.TRANSACTION_ID));
> >         MDC.remove(LoggingConstant.TRANSACTION_ID);
> >         return invocationResponse;
> >     }
> >
> > but it is not set in most Actions of module_1 & module_2
> >
> > \T,
> >
> >
> >
> >
> >
> > On 27/08/13 13:55, Dave Newton wrote:
> >
> > What doesn't work?
> >
> > Dave
> >  On Aug 27, 2013 7:08 AM, "Thomas Lionel SMETS (prof)" <
> tsmets@a3-system.eu> <ts...@a3-system.eu>
> > wrote:
> >
> >
> >  I created my interceptor stack in the top-level struts.xml, like this :
> > <!DOCTYPE struts PUBLIC
> >   "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
> >   "http://struts.apache.org/dtds/struts-2.3.dtd" <
> http://struts.apache.org/dtds/struts-2.3.dtd><
> http://struts.apache.org/dtds/struts-2.3.dtd> <
> http://struts.apache.org/dtds/struts-2.3.dtd>
> >
> >   <struts>
> >
> >     <package name="default" namespace="/" extends="struts-default">
> >
> >         <interceptors>
> >             <interceptor name="logging"
> > class="com.mysite.common.MdcLoggingUtility"/>
> >             <interceptor-stack name="MyStack">
> >                 <interceptor-ref name="params">
> >                     <param
> name="acceptParamNames">^[a-zA-Z0-9_]+$</param>
> >                     <param name="paramNameMaxLength">40</param>
> >                 </interceptor-ref>
> >                 <interceptor-ref name="timer" >
> >                     <param name="logLevel">info</param>
> >                 </interceptor-ref>
> >                 <interceptor-ref name="defaultStack" />
> >             </interceptor-stack>
> >         </interceptors>
> >
> >         <default-interceptor-ref name="MyStack" />
> >
> > ...
> >
> >     <include file="module_1/struts.xml" />
> >     <include file="module_2/struts.xml" />
> > </struts>
> >
> >
> > I have tried different declaration in the submodules but thay all seems
> to
> > not thoroughly work.
> > So having the same declaration or the same declaration with different
> name
> > for the interceptor or using "MyStack" in the extends ...
> >
> >
> > Any idea would be appreaciated.
> >
> > Tx,
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > Thomas Lionel SMETS, CISSP (385434)
> > *m :* +32 497 44 68 12
> > *ph :* +32 2 852 3341
> > *skype :* thomas.lionel.smets
> >
> > PGP = FDF0 8FB8 4F37 3F79 1011 05AB 0DCE 9BAB 5DD0 0E10
> >
> >
> >
> >
> > --
> > Thomas Lionel SMETS, CISSP (385434)
> > *m :* +32 497 44 68 12
> > *ph :* +32 2 852 3341
> > *skype :* thomas.lionel.smets
> >
> > PGP = FDF0 8FB8 4F37 3F79 1011 05AB 0DCE 9BAB 5DD0 0E10
> >
>
>
>
> --
> e: davelnewton@gmail.com
> m: 908-380-8699
> s: davelnewton_skype
> t: @dave_newton <https://twitter.com/dave_newton>
> b: Bucky Bits <http://buckybits.blogspot.com/>
> g: davelnewton <https://github.com/davelnewton>
> so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>
>

Re: Interceptor in various struts.xml

Posted by Dave Newton <da...@gmail.com>.
Are the actions in the same package?

You need to provide more information; we cannot see your project and
without specifics, we have to guess.

Dave



On Tue, Aug 27, 2013 at 9:30 AM, Thomas Lionel SMETS (prof) <
tsmets@a3-system.eu> wrote:

>  Typically, MdcLoggingUtility does this :
>
>    @Override
>     public String intercept(ActionInvocation invocation) throws Exception
> {
>         /*
>          * This code puts a unique Id to the Mapped Diagnostic
>          * context. Since MDC is a static class, we can directly access it
>          * with out creating a new object from it.
>          */
>         String uniqueId =
> UniqueIdGenerator.generateId(Constants.MAX_UNIQUE_ID_LENGTH);
>         MDC.put(LoggingConstant.TRANSACTION_ID, uniqueId);
>         if(LOG.isInfoEnabled())
>             LOG.info("Putting a unique ID in the context : " + uniqueId);
>         String invocationResponse = invocation.invoke();
>         if(LOG.isInfoEnabled())
>             LOG.info("Removing unique ID from the context : " +
> MDC.get(LoggingConstant.TRANSACTION_ID));
>         MDC.remove(LoggingConstant.TRANSACTION_ID);
>         return invocationResponse;
>     }
>
> but it is not set in most Actions of module_1 & module_2
>
> \T,
>
>
>
>
>
> On 27/08/13 13:55, Dave Newton wrote:
>
> What doesn't work?
>
> Dave
>  On Aug 27, 2013 7:08 AM, "Thomas Lionel SMETS (prof)" <ts...@a3-system.eu> <ts...@a3-system.eu>
> wrote:
>
>
>  I created my interceptor stack in the top-level struts.xml, like this :
> <!DOCTYPE struts PUBLIC
>   "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
>   "http://struts.apache.org/dtds/struts-2.3.dtd" <http://struts.apache.org/dtds/struts-2.3.dtd><http://struts.apache.org/dtds/struts-2.3.dtd> <http://struts.apache.org/dtds/struts-2.3.dtd>
>
>   <struts>
>
>     <package name="default" namespace="/" extends="struts-default">
>
>         <interceptors>
>             <interceptor name="logging"
> class="com.mysite.common.MdcLoggingUtility"/>
>             <interceptor-stack name="MyStack">
>                 <interceptor-ref name="params">
>                     <param name="acceptParamNames">^[a-zA-Z0-9_]+$</param>
>                     <param name="paramNameMaxLength">40</param>
>                 </interceptor-ref>
>                 <interceptor-ref name="timer" >
>                     <param name="logLevel">info</param>
>                 </interceptor-ref>
>                 <interceptor-ref name="defaultStack" />
>             </interceptor-stack>
>         </interceptors>
>
>         <default-interceptor-ref name="MyStack" />
>
> ...
>
>     <include file="module_1/struts.xml" />
>     <include file="module_2/struts.xml" />
> </struts>
>
>
> I have tried different declaration in the submodules but thay all seems to
> not thoroughly work.
> So having the same declaration or the same declaration with different name
> for the interceptor or using "MyStack" in the extends ...
>
>
> Any idea would be appreaciated.
>
> Tx,
>
>
>
>
>
>
>
>
>
>
>
> --
> Thomas Lionel SMETS, CISSP (385434)
> *m :* +32 497 44 68 12
> *ph :* +32 2 852 3341
> *skype :* thomas.lionel.smets
>
> PGP = FDF0 8FB8 4F37 3F79 1011 05AB 0DCE 9BAB 5DD0 0E10
>
>
>
>
> --
> Thomas Lionel SMETS, CISSP (385434)
> *m :* +32 497 44 68 12
> *ph :* +32 2 852 3341
> *skype :* thomas.lionel.smets
>
> PGP = FDF0 8FB8 4F37 3F79 1011 05AB 0DCE 9BAB 5DD0 0E10
>



-- 
e: davelnewton@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>

Re: Interceptor in various struts.xml

Posted by "Thomas Lionel SMETS (prof)" <ts...@a3-system.eu>.
Typically, MdcLoggingUtility does this :

   @Override
    public String intercept(ActionInvocation invocation) throws
Exception {       
        /*
         * This code puts a unique Id to the Mapped Diagnostic
         * context. Since MDC is a static class, we can directly access it
         * with out creating a new object from it.
         */
        String uniqueId =
UniqueIdGenerator.generateId(Constants.MAX_UNIQUE_ID_LENGTH);
        MDC.put(LoggingConstant.TRANSACTION_ID, uniqueId);       
        if(LOG.isInfoEnabled())   
            LOG.info("Putting a unique ID in the context : " + uniqueId);
        String invocationResponse = invocation.invoke();
        if(LOG.isInfoEnabled())   
            LOG.info("Removing unique ID from the context : " +
MDC.get(LoggingConstant.TRANSACTION_ID));
        MDC.remove(LoggingConstant.TRANSACTION_ID);
        return invocationResponse;       
    }

but it is not set in most Actions of module_1 & module_2

\T,





On 27/08/13 13:55, Dave Newton wrote:
> What doesn't work?
>
> Dave
>  On Aug 27, 2013 7:08 AM, "Thomas Lionel SMETS (prof)" <ts...@a3-system.eu>
> wrote:
>
>> I created my interceptor stack in the top-level struts.xml, like this :
>> <!DOCTYPE struts PUBLIC
>>   "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
>>   "http://struts.apache.org/dtds/struts-2.3.dtd"<http://struts.apache.org/dtds/struts-2.3.dtd>
>> <struts>
>>
>>     <package name="default" namespace="/" extends="struts-default">
>>
>>         <interceptors>
>>             <interceptor name="logging"
>> class="com.mysite.common.MdcLoggingUtility"/>
>>             <interceptor-stack name="MyStack">
>>                 <interceptor-ref name="params">
>>                     <param name="acceptParamNames">^[a-zA-Z0-9_]+$</param>
>>                     <param name="paramNameMaxLength">40</param>
>>                 </interceptor-ref>
>>                 <interceptor-ref name="timer" >
>>                     <param name="logLevel">info</param>
>>                 </interceptor-ref>
>>                 <interceptor-ref name="defaultStack" />
>>             </interceptor-stack>
>>         </interceptors>
>>
>>         <default-interceptor-ref name="MyStack" />
>>
>> ...
>>
>>     <include file="module_1/struts.xml" />
>>     <include file="module_2/struts.xml" />
>> </struts>
>>
>>
>> I have tried different declaration in the submodules but thay all seems to
>> not thoroughly work.
>> So having the same declaration or the same declaration with different name
>> for the interceptor or using "MyStack" in the extends ...
>>
>>
>> Any idea would be appreaciated.
>>
>> Tx,
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> Thomas Lionel SMETS, CISSP (385434)
>> *m :* +32 497 44 68 12
>> *ph :* +32 2 852 3341
>> *skype :* thomas.lionel.smets
>>
>> PGP = FDF0 8FB8 4F37 3F79 1011 05AB 0DCE 9BAB 5DD0 0E10
>>


-- 
Thomas Lionel SMETS, CISSP (385434)
*m :* +32 497 44 68 12
*ph :* +32 2 852 3341
*skype :* thomas.lionel.smets

PGP = FDF0 8FB8 4F37 3F79 1011 05AB 0DCE 9BAB 5DD0 0E10

Re: Interceptor in various struts.xml

Posted by Lukasz Lenart <lu...@apache.org>.
2013/8/28 Ken McWilliams <ke...@gmail.com>:
> Not looking that closely but both your packages extend "struts-default" if
> you want the interceptors/results of package "default" to be available to
> package "M1" you should extend "default" on that package rather than
> "struts-default"...

Exactly! How do you want to inherit interceptors without inheritance ? :]


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

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


Re: Interceptor in various struts.xml

Posted by Ken McWilliams <ke...@gmail.com>.
Not looking that closely but both your packages extend "struts-default" if
you want the interceptors/results of package "default" to be available to
package "M1" you should extend "default" on that package rather than
"struts-default"...


On Tue, Aug 27, 2013 at 5:04 PM, Thomas Lionel SMETS (prof) <
tsmets@a3-system.eu> wrote:

>  So, I found a solution to the issue.
> Defining the MDC-interceptor is done like this :
> <?xml version="1.0" encoding="UTF-8" ?>
>
> <!DOCTYPE struts PUBLIC
>   "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
>   "http://struts.apache.org/dtds/struts-2.3.dtd"<http://struts.apache.org/dtds/struts-2.3.dtd>
> >
> <struts>
>     <package name="default" namespace="/" extends="struts-default">
>         <interceptors>
>             <interceptor name="MDC"
> class="be.a3-system.util.MdcLoggingUtility">
>             </interceptor>
>
>             <interceptor-stack name="MyStack">
>                 <interceptor-ref name="MDC" ></interceptor-ref>
>
>
>                 <interceptor-ref name="params">
>                     <param name="acceptParamNames">^[a-zA-Z0-9_]+$</param>
>                     <param name="paramNameMaxLength">40</param>
>                 </interceptor-ref>
>
>                 <interceptor-ref name="timer" >
>                     <param name="logLevel">info</param>
>                 </interceptor-ref>
>
>                 <interceptor-ref name="defaultStack" />
>             </interceptor-stack>
>         </interceptors>
>
>         <default-interceptor-ref name="MyStack" />
>
>         <action name="Hello" class="be.a3-system.action.HelloAction">
>             <result name="success">/WEB-INF/Hello.jsp</result>
>             <param name="scenario">DEFAULT</param>
>         </action>
>
>         <action name="*" class="be.a3-system.action.CatchAllAction">
>             <result name="success">/WEB-INF/CatchAll.jsp</result>
>         </action>
>
>     </package>
>
>     <include file="m1/struts.xml" />
>     <include file="m2/struts.xml" />
>
> </struts>
>
> But this interceptor is not propagated to the m1/struts.xml &
> m2/struts.xml.
> The interceptor needs to be added to the included files.
> With something like this :
>
> <?xml version="1.0" encoding="UTF-8" ?>
>
> <!DOCTYPE struts PUBLIC
>   "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
>   "http://struts.apache.org/dtds/struts-2.3.dtd"<http://struts.apache.org/dtds/struts-2.3.dtd>
> >
> <struts>
>     <package name="M1" namespace="/m1" extends="struts-default">
>
>         <interceptors>
>             <interceptor name="MDC"
> class="be.a3-system.util.MdcLoggingUtility">
>             </interceptor>
>
>             <interceptor-stack name="MyM1Stack">
>                 <interceptor-ref name="MDC" ></interceptor-ref>
>
>
>                 <interceptor-ref name="params">
>                     <param name="acceptParamNames">^[a-zA-Z0-9_]+$</param>
>                     <param name="paramNameMaxLength">40</param>
>                 </interceptor-ref>
>
>                 <interceptor-ref name="timer" >
>                     <param name="logLevel">info</param>
>                 </interceptor-ref>
>
>                 <interceptor-ref name="defaultStack" />
>             </interceptor-stack>
>         </interceptors>
>
>         <default-interceptor-ref name="MyM1Stack" />
>
>         <action name="Hello" class="be.a3-system.action.HelloAction">
>             <result name="success">/WEB-INF/Hello.jsp</result>
>             <param name="scenario">M1</param>
>         </action>
>
>         <action name="*" class="be.a3-system.action.CatchAllAction">
>             <result name="success">/WEB-INF/CatchAll.jsp</result>
>         </action>
>
>     </package>
>
> </struts>
>
>
>
>
>
>
>
> \T,
>
>
>
> On 27/08/13 13:55, Dave Newton wrote:
>
> What doesn't work?
>
> Dave
>  On Aug 27, 2013 7:08 AM, "Thomas Lionel SMETS (prof)" <ts...@a3-system.eu> <ts...@a3-system.eu>
> wrote:
>
>
>  I created my interceptor stack in the top-level struts.xml, like this :
> <!DOCTYPE struts PUBLIC
>   "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
>   "http://struts.apache.org/dtds/struts-2.3.dtd" <http://struts.apache.org/dtds/struts-2.3.dtd><http://struts.apache.org/dtds/struts-2.3.dtd> <http://struts.apache.org/dtds/struts-2.3.dtd>
>
>   <struts>
>
>     <package name="default" namespace="/" extends="struts-default">
>
>         <interceptors>
>             <interceptor name="logging"
> class="com.mysite.common.MdcLoggingUtility"/>
>             <interceptor-stack name="MyStack">
>                 <interceptor-ref name="params">
>                     <param name="acceptParamNames">^[a-zA-Z0-9_]+$</param>
>                     <param name="paramNameMaxLength">40</param>
>                 </interceptor-ref>
>                 <interceptor-ref name="timer" >
>                     <param name="logLevel">info</param>
>                 </interceptor-ref>
>                 <interceptor-ref name="defaultStack" />
>             </interceptor-stack>
>         </interceptors>
>
>         <default-interceptor-ref name="MyStack" />
>
> ...
>
>     <include file="module_1/struts.xml" />
>     <include file="module_2/struts.xml" />
> </struts>
>
>
> I have tried different declaration in the submodules but thay all seems to
> not thoroughly work.
> So having the same declaration or the same declaration with different name
> for the interceptor or using "MyStack" in the extends ...
>
>
> Any idea would be appreaciated.
>
> Tx,
>
>
>
>
>
> --
> Thomas Lionel SMETS, CISSP (385434)
> *m :* +32 497 44 68 12
> *ph :* +32 2 852 3341
> *skype :* thomas.lionel.smets
>
>
> PGP = FDF0 8FB8 4F37 3F79 1011 05AB 0DCE 9BAB 5DD0 0E10
>

Re: Interceptor in various struts.xml

Posted by "Thomas Lionel SMETS (prof)" <ts...@a3-system.eu>.
So, I found a solution to the issue.
Defining the MDC-interceptor is done like this :
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
  "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
    <package name="default" namespace="/" extends="struts-default">
        <interceptors>
            <interceptor name="MDC"
class="be.a3-system.util.MdcLoggingUtility">
            </interceptor>
           
            <interceptor-stack name="MyStack">
                <interceptor-ref name="MDC" ></interceptor-ref>
           
                <interceptor-ref name="params">
                    <param name="acceptParamNames">^[a-zA-Z0-9_]+$</param>
                    <param name="paramNameMaxLength">40</param>
                </interceptor-ref>
               
                <interceptor-ref name="timer" >
                    <param name="logLevel">info</param>
                </interceptor-ref>   
               
                <interceptor-ref name="defaultStack" />
            </interceptor-stack>
        </interceptors>

        <default-interceptor-ref name="MyStack" />
       
        <action name="Hello" class="be.a3-system.action.HelloAction">
            <result name="success">/WEB-INF/Hello.jsp</result>
            <param name="scenario">DEFAULT</param>
        </action>

        <action name="*" class="be.a3-system.action.CatchAllAction">
            <result name="success">/WEB-INF/CatchAll.jsp</result>
        </action>

    </package>
    
    <include file="m1/struts.xml" />
    <include file="m2/struts.xml" />
   
</struts>

But this interceptor is not propagated to the m1/struts.xml & m2/struts.xml.
The interceptor needs to be added to the included files.
With something like this :

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
  "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
    <package name="M1" namespace="/m1" extends="struts-default">
        
        <interceptors>
            <interceptor name="MDC"
class="be.a3-system.util.MdcLoggingUtility">
            </interceptor>
           
            <interceptor-stack name="MyM1Stack">
                <interceptor-ref name="MDC" ></interceptor-ref>
           
                <interceptor-ref name="params">
                    <param name="acceptParamNames">^[a-zA-Z0-9_]+$</param>
                    <param name="paramNameMaxLength">40</param>
                </interceptor-ref>
               
                <interceptor-ref name="timer" >
                    <param name="logLevel">info</param>
                </interceptor-ref>   
               
                <interceptor-ref name="defaultStack" />
            </interceptor-stack>
        </interceptors>

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

        <action name="Hello" class="be.a3-system.action.HelloAction">
            <result name="success">/WEB-INF/Hello.jsp</result>
            <param name="scenario">M1</param>
        </action>

        <action name="*" class="be.a3-system.action.CatchAllAction">
            <result name="success">/WEB-INF/CatchAll.jsp</result>
        </action>

    </package>
   
</struts>






\T,



On 27/08/13 13:55, Dave Newton wrote:
> What doesn't work?
>
> Dave
>  On Aug 27, 2013 7:08 AM, "Thomas Lionel SMETS (prof)" <ts...@a3-system.eu>
> wrote:
>
>> I created my interceptor stack in the top-level struts.xml, like this :
>> <!DOCTYPE struts PUBLIC
>>   "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
>>   "http://struts.apache.org/dtds/struts-2.3.dtd"<http://struts.apache.org/dtds/struts-2.3.dtd>
>> <struts>
>>
>>     <package name="default" namespace="/" extends="struts-default">
>>
>>         <interceptors>
>>             <interceptor name="logging"
>> class="com.mysite.common.MdcLoggingUtility"/>
>>             <interceptor-stack name="MyStack">
>>                 <interceptor-ref name="params">
>>                     <param name="acceptParamNames">^[a-zA-Z0-9_]+$</param>
>>                     <param name="paramNameMaxLength">40</param>
>>                 </interceptor-ref>
>>                 <interceptor-ref name="timer" >
>>                     <param name="logLevel">info</param>
>>                 </interceptor-ref>
>>                 <interceptor-ref name="defaultStack" />
>>             </interceptor-stack>
>>         </interceptors>
>>
>>         <default-interceptor-ref name="MyStack" />
>>
>> ...
>>
>>     <include file="module_1/struts.xml" />
>>     <include file="module_2/struts.xml" />
>> </struts>
>>
>>
>> I have tried different declaration in the submodules but thay all seems to
>> not thoroughly work.
>> So having the same declaration or the same declaration with different name
>> for the interceptor or using "MyStack" in the extends ...
>>
>>
>> Any idea would be appreaciated.
>>
>> Tx,
>>
>>


-- 
Thomas Lionel SMETS, CISSP (385434)
*m :* +32 497 44 68 12
*ph :* +32 2 852 3341
*skype :* thomas.lionel.smets

PGP = FDF0 8FB8 4F37 3F79 1011 05AB 0DCE 9BAB 5DD0 0E10

Re: Interceptor in various struts.xml

Posted by Dave Newton <da...@gmail.com>.
What doesn't work?

Dave
 On Aug 27, 2013 7:08 AM, "Thomas Lionel SMETS (prof)" <ts...@a3-system.eu>
wrote:

>
> I created my interceptor stack in the top-level struts.xml, like this :
> <!DOCTYPE struts PUBLIC
>   "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
>   "http://struts.apache.org/dtds/struts-2.3.dtd"<http://struts.apache.org/dtds/struts-2.3.dtd>
> >
> <struts>
>
>     <package name="default" namespace="/" extends="struts-default">
>
>         <interceptors>
>             <interceptor name="logging"
> class="com.mysite.common.MdcLoggingUtility"/>
>             <interceptor-stack name="MyStack">
>                 <interceptor-ref name="params">
>                     <param name="acceptParamNames">^[a-zA-Z0-9_]+$</param>
>                     <param name="paramNameMaxLength">40</param>
>                 </interceptor-ref>
>                 <interceptor-ref name="timer" >
>                     <param name="logLevel">info</param>
>                 </interceptor-ref>
>                 <interceptor-ref name="defaultStack" />
>             </interceptor-stack>
>         </interceptors>
>
>         <default-interceptor-ref name="MyStack" />
>
> ...
>
>     <include file="module_1/struts.xml" />
>     <include file="module_2/struts.xml" />
> </struts>
>
>
> I have tried different declaration in the submodules but thay all seems to
> not thoroughly work.
> So having the same declaration or the same declaration with different name
> for the interceptor or using "MyStack" in the extends ...
>
>
> Any idea would be appreaciated.
>
> Tx,
>
>
>
>
>
>
>
>
>
>
>
> --
> Thomas Lionel SMETS, CISSP (385434)
> *m :* +32 497 44 68 12
> *ph :* +32 2 852 3341
> *skype :* thomas.lionel.smets
>
> PGP = FDF0 8FB8 4F37 3F79 1011 05AB 0DCE 9BAB 5DD0 0E10
>