I was going to something very similar. I wouldn't recommend it, since plugins are loaded in a random order. If another plugin did this same practice...there would be no guarantee which one runs last. That being said, it should word with limited success. There may be a scope issue with having a child package of struts-default being the master default interceptor stack (but that's based off of a "just feels odd" guess, more so than fact). If you do try it, please share your thoughts.
Ryan and Mandar, thanks for the replies.
I could get the interceptor working in the plugin's struts.xml using the following approach:
I had to redefine the package "community-default" as "my-default". And then make every package that extended 'community-default' extend 'my-default', by redefining them in struts.xml as shown below.
<package name="my-default" extends="struts-default">...........
<package name="my-community-actions-include" extends="my-default">...................
This only worked as long as other plugins didn't override actions defined in this plugin. So to overcome this limitation I had to switch to overlay approach.
Hi Suneel, I am trying to do the same as you did but I think I am missing something or doing something wrong and I will appreciate your help.
After reading your post I tried something like this in my struts.xml:
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
<!-- This is my own package, where I define my interceptor and I set it up to apply to all the package -->
<package name="mydefault" extends="struts-default">
<interceptor name="myInterceptor" class="my.package.MyInterceptor">
<!-- Next line is to make my interceptor apply to all the package -->
<!-- This is the redefinition of the global package -->
<package name="community-default" extends="mydefault">
Do you see something wrong in my code?